On Thu, Sep 29, 2016 at 12:16 PM, Ary Borenszweig
<
aboren...@manas.com.ar> wrote:
> It's not about it being possible or impossible. Pretty much everything is
> possible :-)
>
> The thing is if we want every file to begin like this:
>
> ~~~
> import foo from bla
> import lala, lele from bleh
> import some_more
> import hmm_this_is_getting_a_bit_tedious_to_write
> import oh_and_ill_need_to_do_this_in_many_more_files
>
> puts "hello" # finally some code that does something!
perhaps a "*" option would be useful, or a default that is "everything"
> ~~~
>
> vs this:
>
> ~~~
> puts "hello"
> ~~~
>
> In Ruby you see very few requires, probably once in a project to use
> everywhere, because everything is globally namespaced. This can bring
> clashes and conflicts, maybe some time ago that might have been a problem
> but now that we are all connected and pretty much know what namespaces are
> occurpied it's less of a problem. Ruby worked very well in this regards and
> the community managed to evolve without problems. Refinements were
> introduced to "solve" this problem, but nobody seems to use them.
>
> So again, it's not that we don't know how to do it or that it can't be done,
> it's just that it's simpler to do it with "require" (less typing, less
> boilerplate, less cluttering, despite some possible conflicts)
OK good to know it's theoretically possible :)
In terms of philosophy...I'd say that it (can be) more clear where
classes originate, so you can know in which codebase to look if you
want to track down a class (less "magic" as it were).
As well as avoiding namespace conflicts, as you mentioned ("DB" comes
to mind here, though it was coincidence it was included in my
question).
Cheers!
-roger-
> You received this message because you are subscribed to a topic in the
> Google Groups "Crystal" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/crystal-lang/Yid3gQnlKyI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
>
https://groups.google.com/d/msgid/crystal-lang/CA%2BdJ3wT3XS2uXKFTcdnegsf8xhT_M-jvnT3oC06iZAM8ubRaNA%40mail.gmail.com.