On Monday, 30 March 2015 at 07:45:50 UTC, Paulo Pinto wrote:
On Monday, 30 March 2015 at 03:26:14 UTC, deadalnix wrote:
On Sunday, 29 March 2015 at 16:32:32 UTC, Idan Arye wrote:
Computer science is all about tradeoffs. I used to love Ruby,
but then a Rails project got out of hand... Nowadays I use it
mainly as a bash replacement - Hundredfolds more expressive,
only a tiny tiny bit syntax overhead, and for things that
bash's safety would be enough Ruby's certainly suffices.
This is pretty much the recurring story with ruby. The first
10 000 lines are a lot of fun, and then it gets out of hands.
Just like any other language with dynamic typing.
This has more to do with the module system than with the typing.
In Ruby, the `require` function reads a source file and
interprets it in the global namespace. This means that from that
point on, all symbols declared in that source file(and the source
files it `require`s) are now part of the global namespace and
accessible from anywhere(even from places that didn't `require`
it), and that all monkey-patching done in that source file from
now on applies *everywhere*.
Compare it to Python, that has a module system that handles
namespacing and forces you to `import` a module in each scope you
want to use it. This means that if foo.py uses stuff from bar.py
it must `import` it directly and can't rely on some other baz.py
that might dropt it's `import` to bar.py because it no longer
needs it without knowing that foo.py was using it.
Note that Ruby does has `module`s that can be used for
namespacing(or for mixins...) but using them is a hassle, because
you either have to always use fully qualified names or to `mixin`
them into the current namespace(which propagates to other scopes
that want to use stuff from YOUR namespace...)
Also note that Python also has ways to mess with the gloabl
context - but you have to actually dig in to do this, compared to
Ruby where messing up the global context is the standard way of
doing things.