4 ms·
Perl was the first language I loved, and I'll always love it, but I'm sticking with ruby. No more my $self = shift
by chrismealy 15y ago
Perl was the first language I loved, and I'll always love it, but I'm sticking with ruby. No more my $self = shift
- DanielRibeiro 15y agoAlso, Ruby's lack of @ $ % is great. And the fact that it has a single object model, not falling to the Paradox of Choice[1] makes it a great alternative to Perl. And what is best: I've never seen anyone that loved Perl not enjoy Ruby. They both have very similar ideologies, but Ruby stands on the shoulders of Perl, Smalltalk and Lisp. Therefore it could see farther. [1] http://en.wikipedia.org/wiki/The_Paradox_of_Choice:_Why_More_Is_Less http://en.wikipedia.org/wiki/The_Paradox_of_Choice:_Why_More...
- rcfox 15y ago"In Ruby, ordinary variables lack sigils, but "$" is prefixed to global variables, "@" is prefixed to instance variables, and "@@" is prefixed to class variables."[0] Okay, I don't know Ruby well enough to know if these are commonly used features, but the statement that there are no sigils is false. [0] http://en.wikipedia.org/wiki/Sigil_(computer_programming)#Language_comparison http://en.wikipedia.org/wiki/Sigil_(computer_programming)#La...
- pyrhho 15y ago@ is common.. The others are pretty rare.
- prophetjohn 15y agoRuby even uses some predefined globals (eg $_) that are pretty much straight out of Perl. http://www.tutorialspoint.com/ruby/ruby_predefined_variables.htm http://www.tutorialspoint.com/ruby/ruby_predefined_variables...
- jamesbritt 15y agoRuby even uses some predefined globals (eg $_) that are pretty much straight out of Perl. They exist, and while I'm a fan of $: over $LOAD_PATH I don't think I've even seen $_ used in the wild.
- prophetjohn 15y agoI don't really have the perspective to comment on how common they are, but they do exist. Ruby is full of little things like this, which one of the things I simultaneously love and hate about Ruby
- DanielRibeiro 15y agoYou are right. What I should have said is: "the lack of sigils to indicate type of a variable". In perl this noise is everywhere, while in Ruby its is a lot less common. Specially if you use accessor methods. In ruby, unlike smalltalk, this instance variable sigils are pretty much impossible to get rid off. This is because in Smalltalk local variables have to be declared, and if you don't, the Language will try to use the instance variables. In Ruby it would default to being a local variable, if already assigned, or invoking a method with no arguments.
- berntb 15y ago>>No more my $self = shift E.g.: use Method::Signatures::Simple; method get_file_sizes(@files) { # ... }