7 ms·
Virgil: a statically-typed language balancing functional and OO features
- GIFtheory 14y agoBeen there, done that: http://caml.inria.fr/ocaml/ http://caml.inria.fr/ocaml/
- mahmud 14y agoCLOS goes back to 1986 :-) http://common-lisp.net/ http://common-lisp.net/
- seanmcdirmid 14y agoOMG new language includes feature of previous existing language! News at 11. I'm shocked that people still don't understand what language design is. It's mostly not about inventing new features, but putting them together in new and interesting ways. Hence the "design."
- kodablah 14y agoLink to Google project page: http://code.google.com/p/virgil/ http://code.google.com/p/virgil/
- MostAwesomeDude 14y agoI'm a little annoyed at the name, because of Virgil, the Java-like language for embedded programming: http://compilers.cs.ucla.edu/virgil/ http://compilers.cs.ucla.edu/virgil/
- munificent 14y agoThat's the same language, actually. Well, maybe a previous incarnation of it. But both are Ben Titzer's babies either way.
- weix 14y agocreating a special language is not hard, but it's really hard to make ppl feel exciting to use it.
- ritchiea 14y agoTerse comments aren't hard, just bash the OP without offering constructive criticism. The next programming language to become popular is going to provide some substantial gain in either productivity or performance. It'd be nice to see an argument for or against Virgil on that front.
- trungonnews 14y agoDoesn't Scala do this already?
- deleted 14y ago[deleted]
- octo_t 14y agoIt seems very similar to Scala in several ways (var, def etc), but the way to declare immutable fields is different from Scala Scala val x:Int = 10 // Immutable var x:Int = 10 // Mutable def x:Int = 10 // function Virgil def x:Int = 10 // Immutable + function var x:Int = 10 // Mutable I think I prefer Virgils method, it feels much purer to me, in keeping with functions as first class members, but I'm not sure how it would handle mutable datastructures.
- ismarc 14y agoIt's actually more complex than that. You can use val and def in the same places. The difference is when it is evaluated. val has the right hand side evaluated immediately (such as, if it's a class member, it will be evaluated when the class is constructed). def has the right hand side evaluated every time it is referenced. So, val x = 5+5 would evaluate 5+5 and assign to x. def x = 5+5 would set x to a function that takes no parameters and returns an int, but if you had, say x + x, that function would be called twice, resulting in a value of 20. This difference is stark when you look at what it's doing, but allows for some interesting uses when combined with lazy vals. We use it pretty extensively in our configuration loader (using twitter-eval) that allows us to do per-value overrides of configuration files by using lazy vals assigned to defs and then using the defs in the application (of all the performance bottlenecks we have, the possibly optimized out function call generated for the defs is negligible). The end result is that you can derive values from configuration settings prior to the configuration finishing being loaded. This means we don't have to care what order the configuration files are loaded in (they're separated by what they're configuring, with many shared between applications).