Re:Unveiling the big leap in Ruby 3.3's IRB
by djur on Sunday December 24, 2023 @03:42AM
(#38752171)
What "special characters" are you talking about in Ruby? My impression is that Ruby and Python are roughly equivalent in terms of non-alphanumeric characters used in syntax.
[ Parent
| on HN ]
Re:Unveiling the big leap in Ruby 3.3's IRB
by ajanuary on Sunday December 24, 2023 @08:22AM
(#38753293)
Some symbols I can think of that Ruby uses that python doesn’t:
$ for global vars
@ for instance vars
:: for namespace stuff
=> for map key, value separator
{||} for blocks
.. and … for ranges
%w for special array construction
: for symbols
? and - in method names
?: for ternary expressions
#{} for string interpolation
And python that Ruby doesn’t have: :: for slices @ for decorators
And for the symbols that they both share, subjectively, a lot of them are used for often in Ruby.
Re:Unveiling the big leap in Ruby 3.3's IRB
by ric2b on Monday December 25, 2023 @10:55AM
(#38763593)
Ruby does have the block related stuff like the & argument and the single line block { }. But other than that I also think it's relatively similar to Python (which doesn't even support blocks anyway).