Sorry for the ----- and the ==> to mark my reply, but I made a mistake when I first suscribed, and now I don't find the page to change my settings to "receive emails". Right now I've only access to the archive.
> I've seen a brand new language called "transmuter" with very interesting > features. It's aimed to "evolutionnary programming". > If you look here : http://www.transmuter.org/modifier.html > You will see two interresting features, called "define" and "transient" that are > caode evaluated at compile time. I think it's a bit like lazy evaluation. But > I'm not a specialist of this kind of feature. > So my question is : would it be a interesting feature to add to Neko ? (rather > in Neko than in NekoML in my opinion), and would it be hard to implement ? ------ To me, they just look like macros/inlined functions. It's quite difficult to add to Neko since you don't know the value of a symbol at compile time. For example : plus = function(x,y) { return x + y; }; // some code var three = plus(1,2); It's difficult to tell if "plus" is assigned in "some code" since there can be function calls to previously defined functions that will assign "plus". It would at least require an additional compilation pass. ==> I think that's why "Transmuter" introduce 2 new keywords. But, it's not just "macro". Look carefully. "define" is most like macro, it's not compiled on the fly, the defintion is hold, and it's compiled only when used. Ok. "transient" is quite different, since, it's compiled, but ALSO evaluated when used ! that mean the compiler have access to the interpreter. Maybe it should be re-entrant ? I have not think carefully about it. But it's very powerful. Yes, that means an additional compilation pass. And even more, maybe a recursive one. ------- It depends if you are planing to use Neko directly or use an higher level language to generate to it. In that case, you process inlining when generating your code. ==> Yes that's true, I missed that point. I'll think about writing my own language. It's a bit confusing to have such a high level "bytecode" > A remark though, Transmuter have a "builtin" automatic dll import keyword that I > find very interresting ;-). I've seen such a feature in the "Qu' language, and > I'm planning to add it to neko when I'll have the time, some day. ---- I haven't find the "builtin" keyword definition. Neko clearly separate what is a "builtin" which are core functions (prefixed with as $) from "primitives" which are C functions imported from a DLL. In that second case you can load them dynamicly using the loader : var sqrt = $loader.loadprim("std at math_sqrt",1); $print(sqrt(2)); ==> Oups ! sorry, it's NATIVE, and not "builtin", and you can find it here : http://www.transmuter.org/definition.html#native hence, it's not the same as "loader.loadprim", since a native in "transmuter" is a direct call to a C library, and not a call to a wrapper "ndll". As I said before the "Qu" language have such a feature : Look at this (Excerpt from Qu http://centrin.net.id/~marc/features.html) : Dlib enables you to access shared (dynamic) library functions and variables from within your Qu programs. @warn Using this class requires some knowledge of C. Give the wrong type and your program will crash. You can not pass more than 16 arguments to a library function. @xmp libm = Dlib ('/usr/lib/libm.so') r = libm.call ("sin", 'f:f', 1.234) println (r) libm.close @out 0.94381820937463368 @p another powerful feature, to my mind. regards Yo -- Neko : One VM to run them all (http://nekovm.org)
