#383 The future / role of fansh

sampo Mon 27 Oct 2008

What's the planned fansh functionality in the future? Will it support more things (like class / function definitions)? I'd really love to be able to send stuff from editor to a fansh subprocess and test them there (edit/evaluate feels much more comfortable than edit/save/compile/run :-)

brian Mon 27 Oct 2008

The fansh really just evaluates statements and expressions right now. Although if you look at the code you can see it is really just a command line wrapper for calling the normal compiler. I'd love to enhance fansh, although it isn't really a high priority for me right now. I wouldn't mind working with someone who wanted to enhance it.

But you don't actually need to compile Fan to run it - you can just run Fan code as a script file. That is how I have my editor setup - just edit, then run. Is that something you are already doing? Or something we can make easier?

sampo Tue 28 Oct 2008

Great.. running them as scripts is a step in right direction. I played with fansh a bit and found out that I can load my own classes there (at least) with Sys.compile. What I want is that I can load classes into fansh and interactively test them there. This is what I do now (using hello.fan from Fan introduction docs):

fansh> hello_obj := Sys.compile(File(`hello.fan`)).make
fansh> hello_obj->main
Hello world #2
null

Please tell if I do something stupid or if there's more convenient ways to do this.

brian Tue 28 Oct 2008

Please tell if I do something stupid or if there's more convenient ways to do this.

That is probably about the easiest way to do it. You can also use Sys.compile to reload classes - it will check the file timestamp and recompile whenever it detects a change.

Login or Signup to reply.