waj has joined #crystal-lang
asterite has joined #crystal-lang
waj has joined #crystal-lang
asterite has joined #crystal-lang
waj has left #crystal-lang [#crystal-lang]
asterite has joined #crystal-lang
asterite has left #crystal-lang [#crystal-lang]
asterite has joined #crystal-lang
asterite has left #crystal-lang [#crystal-lang]
asterite has joined #crystal-lang
asterite has left #crystal-lang [#crystal-lang]
waj has joined #crystal-lang
archer_ has joined #crystal-lang
asterite has joined #crystal-lang
<
leex>
is crystal going to handle 'require' the same way ruby does or are you guys planning doing it more the python or go way?
waj1 has joined #crystal-lang
asterite1 has joined #crystal-lang
waj1 has left #crystal-lang [#crystal-lang]
<
asterite1>
@leex I like ruby's require
waj1 has joined #crystal-lang
<
asterite1>
I don't like when every file is full of imports, like in Java or Python...
<
asterite1>
But maybe we can make it even simpler by guessing where classes are defined with a simple convention (like what Rails does)
<
C0C0>
asterite1: please don't
waj has joined #crystal-lang
<
C0C0>
seriously rubys require is messed up
<
leex>
it would be nice to do this: require 'bigfile/specific_stuff'
<
C0C0>
asterite1: maybe add something like "require_all_globals"
<
C0C0>
that takes all the stuff that has been required previously and adds it as well...
<
C0C0>
but please make it possible to do "require 'some_plugin' as sp"
asterite has joined #crystal-lang
<
C0C0>
all the pollution of the global namespace is really not a good thing
<
C0C0>
I really think go has got that nearly right
<
asterite>
But why do you have to specify the imports? Can't the compiler be smarter?
<
C0C0>
well there is a set of problems with C style imports
<
C0C0>
e.g. copy the content inlcude
<
asterite>
What problem?
<
C0C0>
well ok you can implement it smarter then in C => performance problem is gone
<
C0C0>
but still the whole polluting the global namespace is bad
<
C0C0>
but for starter it makes compiling multithreaded a lot harder
<
C0C0>
now I might be a little emotionally about this because I just had to fix a bug resulting from such global namespace polution
<
C0C0>
finding a few old files that noone cared about for ages
<
C0C0>
which where included somewhere
<
C0C0>
and overwrote classes / methods depending on the order of inclusion
<
C0C0>
worked fine on all our dev machines
<
asterite>
At least I find it annoying
<
asterite>
Yes, polluting the global namespace is bad, but I find it worse to have to include a series of imports at the top of each of your files
<
asterite>
and in other languages there is a global namespace, it's just scoped by the modules
<
asterite>
so it's almost the same… except that clashes are less probable
waj has left #crystal-lang [#crystal-lang]
<
C0C0>
asterite: well go prevents clashes
<
C0C0>
but yeah the go way can be annoying at times
<
asterite>
But if you write a library you will scope it in a module anyway, so...
<
C0C0>
but that doesn't help if two geniuses come up with the same module names
<
C0C0>
(as in my case)
<
C0C0>
now maybe one could opt to not inherite the global namespace
<
C0C0>
e.g. declare strict_imports or something alike
<
C0C0>
or the ability to "jail" certain things into new namespaces on per file basis
<
C0C0>
e.G. A requires 'something', B and C
<
C0C0>
B uses 'something' implicitly
<
C0C0>
but C uses 'otherthing' and wants to be sure
<
C0C0>
so C states require 'something' as st; require 'otherthing' as ot;
<
C0C0>
and then uses st.bla and ot.bla
<
C0C0>
while the things defined in something are hidden from the global namespace by the explicit inclusion
<
C0C0>
might be to confusing though
<
C0C0>
also: it is fucking complicated to check if a certain file is needed to do X in C like includes
<
C0C0>
its really helpfull if the compiler can explicitly state "this and that package is missing/unused
waj has joined #crystal-lang
asterite has joined #crystal-lang
asterite has joined #crystal-lang
asterite has joined #crystal-lang
asterite has joined #crystal-lang
asterite has joined #crystal-lang
asterite has joined #crystal-lang