Do you support multi-line definitions?
can you define data types and type classes in the REPL as well?
One question: Couldn't we use "let" in place of "def:"
I am sure there will come up lots of questions later
This is definitly a shortcoming of the internet
I am sure there will come up lots of questions laterI would like to hear them all and also about the good-to-have features.
The REPL is not very robust at the moment.
I am trying to eliminate the explicit call to "show" and "doio" to perform IO
and I am thinking of writing a parser (using Scala's parser combinator) to parse modules, imports, top-level definitions and expressions individually.
Seriously, have you thought about integration with the rest of the system? Ideally, we only have 1 jar with standard libraries and tools.
In addition, I'd like to make use of mostly stable code for integration into fregIDE.
This is where I am a bit sceptical. I oppose having different parsers for compiler and interpreter on the ground that either we end up with 2 different languages or we get into maintenance hell trying to keep 2 parsers identical.
To determine whether the script is a top-level definition, an expression or an import, currently the implementation is very naive. So I thought I could use a parser. Reusing the same parser as the compiler is the ideal solution. I looked at Grammar.y but I am not sure how to proceed with this. Any pointers on that direction would be great.
--
PS: I am just starting in frege (and functional programming), and it has been good fun playing with both the eclipse IDE and REPL. However if you know of any help file/ documentation other than the language manual (Language-609.pdf) on code.google.. would anyone please direct me to it. Thanks!
--
Having had a quick look on Google App Engine, I guess we should deploy our applications as war and it runs Java 6 VM. I see two issues with this. Please correct me if I am wrong.1) Currently the 'tryfrege' web application makes a call to another JVM to actually execute the code. So there must be a standalone application which accepts the code and executes it. Since the REPL is running on a seperate JVM (sandbox), in case the code doesn't terminate after a certain time, we could always terminate and restart the REPL. I am not sure whether it is possible with GAE.
2) The GAE Java page says "App Engine runs Java applications using the Java 6 virtual machine (JVM)". But Frege is compiled to Java 7 and I think Java 7 is not currently supported on GAE.
2) The GAE Java page says "App Engine runs Java applications using the Java 6 virtual machine (JVM)". But Frege is compiled to Java 7 and I think Java 7 is not currently supported on GAE.
For example, when an application is called to serve a web request, it must issue a response within 60 seconds. If the application takes too long, the process is terminated and the server returns an error code to the user. The request timeout is dynamic, and may be shortened if a request handler reaches its timeout frequently to conserve resources.
After having setup everything, I finally found out that the Java Compiler API (javax.tools.ToolProvider) is restricted in GAE and couldn't proceed further since the frege code is first compiled with fregec and then javac. Any other options or workaround?
On Monday, 22 October 2012 15:10:05 UTC+13, Marimuthu Madasamy wrote:After having setup everything, I finally found out that the Java Compiler API (javax.tools.ToolProvider) is restricted in GAE and couldn't proceed further since the frege code is first compiled with fregec and then javac. Any other options or workaround?well, that sucks big time. You could always file a bug request to have those classes whitelisted but I suspect it'd be a feature only requested by selected fews.One option could be to just grab those sourcea and repackage them into your app and try to remove any dependency from non-whitelisted classes.
Mind that there's no File IO API on GAE, and that could be a big show stopper. You could mimic that with writes to memcache or to the datastore, or the blobstore (write only).
This is really impressive, congratulations!
So, the JDT compiler implements the same API as the Java Compiler API but is only uses whitelisted classes, is that right?
Have you discovered what classes where not passing the GAE validation?
A REPL could help editing the datastore, given the limitations of the Web Console. And perhaps it could be used for monitoring other instances.
The latest JDT compiler implements Java Compiler API but again we can't use that in GAE since no classes from javax.tools package are whitelisted. So I am using version 3.7 JDT compiler which doesn't implement Java Compiler API.
GAE is not that much restricted as I initially thought, given the nature of REPL (dynamic class loading, reflection etc.). So it should be possible to extend this to other application areas that can fit in the sandbox model.
It all looks pretty responsive. Are you on a free quota or have you paid to keep one instance warm?
No idea how big JDT 3.7 is, have you done some appstats?
It all looks pretty responsive. Are you on a free quota or have you paid to keep one instance warm?I am on free quota. Actually it could be still better responsive if we don't have to serialize the objects on session. If we can keep any objects, the compiler parsed definitions can be stored on the session. Since those definitions are not serializable, currently the source scripts are stored in session and parsed every time.
Here it is: "tryfrege" on Google App Engine http://tryfrege.appspot.com/The Java Compiler API problem on GAE is solved by using Eclipse JDT Compiler. The other problem was that while building Frege compiler for Java 6, the Java 6 compiler was throwing the syntax error as mentioned in this post by Ingo http://stackoverflow.com/questions/5404750/javac-strange-syntax-error-illegal-start-of-expression.
It all looks pretty responsive. Are you on a free quota or have you paid to keep one instance warm?I am on free quota. Actually it could be still better responsive if we don't have to serialize the objects on session. If we can keep any objects, the compiler parsed definitions can be stored on the session. Since those definitions are not serializable, currently the source scripts are stored in session and parsed every time.
It is astonishing how you do such things almost instantly!
Great work!
Didn't they still fix that yet!!!!
Do you remember which file it was where the error occured? Maybe I can put some parenthesis in so that it'll finally be possible to use a bare JDK 1.6.
return Box.<java.lang.Exception>mk(
(java.lang.Exception)(Box.<frege.RT.Undefined>box(arg$1._e()).j)
); Regarding responsiveness, it looks to me like it ran slightly faster on mmhelloworld.
You've done a great job. Just one point, it's a shame we have an automatic tab switch on hover.
Do you think it is a good idea to make algebraic data types Serializable? Would it be a big deal?I think that it would be useful in some areas. In this particular instance, I wanted to store the instances of `DefinitionT` (not sure this can be eligible for serialization) so that whenever a new script is submitted, we can just compare the definitions in the current script with the existing and eliminate the overridden definitions and just run the rest of the definitions as opposed to recompiling the entire history from source to bring back the last REPL state.
--
return Box.<java.lang.Exception>mk(
(java.lang.Exception)(Box.<frege.RT.Undefined>box(arg$1._e()).j)
);
build\frege\prelude\PreludeBase.java:18994: illegal start of expression
(java.lang.Exception)(Box.<frege.RT.Undefined>box(arg$1._e()).j)
^It also implies that we need to store and import all the classes from the previous submissions, right? In that case, this is like our previous approach which we dropped because the expressions once bound are not reevaluated.
Is it really the case, that re-parsing a short script should be that time consuming (several seconds)?
is it possible that a new JVM is started for every line I type?
Is it really the case, that re-parsing a short script should be that time consuming (several seconds)?It is because If we are recompiling from source, it is not just fregec, javac also must be invoked hence the whole process takes time. In AWS instance, the last successful submission is stored in form of fregec parsed definitions so the next time, we don't need the sources from history, instead we can just include those definitions along with the definitions from the current script.
is it possible that a new JVM is started for every line I type?I am also not sure but it looks like to be the case at least for most of the times.
Would it be a good idea or is it possible to serialize the compiler parsed definitions(DefinitionT instances) after a successful fregec compilation?
I don't know if you use fregIDE.
Here, with every keystroke (except when the pause between 2 keystrokes is less than some preconfigured time) all compiler steps from lexical analysis up to type checking are done for the whole program text in the editor buffer.
For example, on recompilation of the compiler on the command line there is this big Grammar.fr, that takes more than 2min to fully compile. The lexer and parser account for less than 7s here. Hence, 5%, give or take some fractions.
Given that to get an answer from Google takes 3 to 4s (for me), we could save no more than non-noticeable 15 to 20/100 seconds, if at all, because Java Serialization also has its cost AFAIK.
frege> foo = one
frege> one
res0 :: Num α => α
frege> foo :: Double
res1 = 1.0
frege> :t foo
Num α => αI guess the right repository for bug reports is frege/scripting?
frege> :l Foo.fr
frege> :r