My understanding is that with perl 6 / parrot, perl will become more extensible and could perhaps add things from other parrot-supported languages.. anyway will perl 6 have things like what ruby has below? In particular can you have code macros to create new languages over perl (like rails). Would such macros be only usable in perl? For that matter I'd also like to know if the basic grammar of perl will be fluid, i.e. if you wanted to be able to include English-like logical statements within perl.
I'm curious about the role Perl will have in the future and if parrot will give it a special role with respect to other languages. It might also have an impact on corporate decisions on whether to use perl or not in the future I suppose.
Automatic get/set method creation:
Now the class Foo has accessor methods (getter and setter) for the instance vars bar, baz and foo. A total of six methods were created from that one line of code. No need for a 'modern Java IDE' - vi or emacs work fine. You want read-only access? Use attr_reader then only the getter methods will be createdclass Foo attr_accessor :bar, :baz, :foo end
Passing code blocks around as macros
That's what I'm talking about. In Python you can't do something like this:
my_while looks like a natural extension of the language. I'm sure you could duplicate this function in Python, but it wouldn't look like a natural part of the language.def my_while(cond) return @ret unless cond @ret = yield retry end my_while i<10 { puts "i: #{i}" j = 0 my_while j<10 { puts " j: #{j}" j+=1 } i+=1 }
Miscellaneous claims
As far as Ruby vs. Python features go:
1) code blocks. Ruby lets you pass code blocks around. Sounds pretty dull, eh? But in fact it's what makes it possible to create Domain Specific Languages in Ruby quite easily without needing to create a special parser. In many ways Rails can be thought of as a domain specific language built on Ruby.
2) classes are always open in Ruby(including the Class class). By 'open' I mean you can always add new methods to a class (or even a particular object). Another feature that makes it easy to create DSLs
3) continuations. (Not that Rails makes use of them, but some other Ruby-based web programming frameworks do)
4) Ruby has true lambdas. AFAIK Python's lambdas are pretty limited (limited to one expression?)
Also, can you embed Python in HTML? (seems that the whitespace issue would cause a lot of problems with doing that)
I'm just looking for the practical solutions...
Give RoR a try. You might just find that it'll do everything you need it to do now without needing to wait around for a Python-based clone. What could be more practical?
In reply to Perl 6 and Ruby on Rails by mattr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |