asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.1 | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal - Docs: http://crystal-lang.org/docs/ - API: http://crystal-lang.org/api/ - Logs: http://irclog.whitequark.org/crystal-lang
eli-se has quit [Quit: Leaving...]
havenn has quit [Ping timeout: 264 seconds]
havenwood has joined #crystal-lang
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 264 seconds]
havenwood has joined #crystal-lang
havenwood has quit [Remote host closed the connection]
havenn has quit [Ping timeout: 252 seconds]
<wanderer> >> ABC = 5; a :: UInt8[ABC]
<DeBot> wanderer: Error in line 3: can't instantiate StaticArray(T, N) with N = Int32 (N must be an integer)
<wanderer> N must be an integer?
<jhass> mh, I'd say bug. File an issue
bcardiff has quit [Quit: Leaving.]
<wanderer> jhass: so it's not like static arrays need real constant dimensions?
<jhass> ?
<jhass> where did I say that?
<wanderer> that's what I assumed after reading the error message
<jhass> no, it's likely just a bug
<wanderer> like in C for example, you can't have an array with a non-hardcoded size (pre-C99)
<jhass> you keep forgetting that a crystal is still a quite young language I think ;)
<wanderer> `const int a = 10; int b[a];` wouldn't work in C
<jhass> a lot of stuff that's weird is weird because nobody thought about it yet
<wanderer> it would be unlikely that crystal wouldn't accept non-hardcoded array sizes, but it's not impossible so I thought this might be the case
weskinner_work has joined #crystal-lang
wanderer has quit [Quit: Page closed]
havenwood has joined #crystal-lang
weskinner_work has quit [Ping timeout: 248 seconds]
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 248 seconds]
havenn has quit [Ping timeout: 265 seconds]
ponga has quit [Remote host closed the connection]
bcardiff has joined #crystal-lang
ponga has joined #crystal-lang
havenwood has joined #crystal-lang
ponga has quit [Quit: Leaving...]
ponga has joined #crystal-lang
ponga has quit [Read error: Connection reset by peer]
ponga has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
canhtak has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
ismaelga has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
ismaelga has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
canhtak has quit [Client Quit]
canhtak has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> !memo wanderer I added support for constants in static arrays a few days ago: https://github.com/manastech/crystal/commit/2bb844c437f301d93e2fc54e861815065f07a9fc . Like jhass said, Crystal still lacks lots of things, we add them as we see the need for them
<DeBot> asterite: Added memo for wanderer.
<jhass> asterite: mmh, I think I asked that some time ago but I forgot the answer, so if you could remind me... Why do we need abstract classes again?
<asterite> We can do with modules just fine, but classes usually have a constructor and the mental model is different, plus the compiler treats a class hierarchy different than just included modules
<jhass> it's just they feel so redundant to modules...
<asterite> I don't know... in the compiler we have a base class ASTNode from which all nodes inherit
<asterite> I would feel it weird if it were a module included by other classes
<asterite> but maybe just because I'm used to model things like that
<jhass> it wouldn't to me
<jhass> yeah, it's because other languages don't have the module
<jhass> I think
<asterite> So Number would be a module too?
<jhass> yup
<jhass> I know its a class in ruby
<jhass> but IMO conceptually a class is a specialization of a module
<jhass> a class is a module of which you can create instances
<jhass> so you want a class that you can't have instances of? -> take a module
<jhass> that's an easy rule of thumb I use to explain when to use a class or a module to people new to ruby
canhtak has quit [Quit: canhtak]
<asterite> I'll have to try and see what happens if I remove "virtual types" from the language, see if it's still fast to compile
<asterite> With that I mean, right now if you have a union B | C, where B < A and C < A, the compiler treats it as A+
<asterite> and that simplifies some things
<jhass> what if we allow inheritance from a module and that turns it into a virtual type?
<asterite> Well, the problem is that you can find many roots like that
<asterite> but with classes you can only find one
<asterite> I know it's an implementation detail that leaks into the language... that's why I'd like to try and see if it's still fast without that rule
<jhass> module A; end; class B < A; end; A becomes A+; module A; end; class B; include A; end; A is a regular module like now
<asterite> The thing is, we added that rule back when the compiler was written in Ruby, which was very, very slow, and that sped up things a lot
<jhass> yeah, I'm looking at this purely conceptual, if it's not feasible implementation wise for whatever reason I can live with that
<asterite> Of course I'd like the purest language if possible :)
<jhass> >> module A; abstract def foo; end; class B; include A; end;
<asterite> (although right now it's far from that, but at least we try to be close, but it's hard with a compiled language... Ruby has it soo easy)
<DeBot> jhass: Sorry, that took too long.
<jhass> heh
<jhass> >> module A; abstract def foo; end; class B; include A; end;
<DeBot> jhass: nil
<jhass> mmh
<jhass> >> module A; abstract def foo; end; class B; include A; end; B.new
<DeBot> jhass: #<B:0x883FFF8>
<jhass> >> module A; abstract def foo; end; class B; include A; end; B.new.foo
<DeBot> jhass: Error in line 3: abstract def A#foo must be implemented by B
<jhass> interesting
<jhass> >> abstract class A; abstract def foo; end; class B < A; end;
<DeBot> jhass: nil
<jhass> >> abstract class A; abstract def foo; end; class B < A; end; B.new
<DeBot> jhass: #<B:0x9B15FF8>
<jhass> okay it's the same though
<jhass> I never noticed :D
<asterite> What?
<jhass> that abstract only fires if you actually call the method
leafybasil has quit [Remote host closed the connection]
<asterite> Ah, yes... we might make it fire at the end of the compilation, a check, even if you don't invoke it
canhtak has joined #crystal-lang
leafybasil has joined #crystal-lang
<asterite> but for now almost all things are lazy
<jhass> anyway, ruby has many quirks, like the root #inspect is implemented in a C function called rb_obj_inspect in object.c, documented on Object but actually defined in Kernel
<jhass> don't feel too bad ;)
<asterite> :-P
<asterite> I think maybe reusing Ruby's syntax and some semantic was not a very good idea
<jhass> I think it is
<asterite> because when you create a new languae you can define rules and people have no idea what the rules are before diving into it
<jhass> it's what made it appealing to me
<asterite> but in Ruby that mental model is pretty complete by now
<asterite> so we change some things and people expect it to work like in Ruby
<jhass> you write "Ruby inspired syntax", I think that hits the point quite well
<asterite> Hehe, yes :)
<asterite> If I say "C inspired syntax" people imagine braces and semicolons
<asterite> but they don't think about the semantic
<asterite> Maybe in Ruby it's different because it's so unique
<jhass> any experienced Rubyist will actually know the shortcomings and quirks of the language quite well and actually be thankful if you don't repeat them
<jhass> some people you need to remind that if they come with "but in Ruby..." but that's it
<jhass> I think there's a net win really
<jhass> modeling after an existing language gives the benefit of some problems solved already, you just need to reevaluate them instead of solving them again
bcardiff has joined #crystal-lang
<asterite> Yes, exactly
asterite has quit [Quit: Page closed]
<crystal-gh> [crystal] asterite closed pull request #499: Adds OptionParser#separator (master...OptionParser#separator) http://git.io/hS4R
<travis-ci> manastech/crystal#2167 (master - 0f79741 : Ary Borenszweig): The build passed.
bcardiff has quit [Quit: Leaving.]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/jkPj
<crystal-gh> crystal/master be376b3 Ary Borenszweig: Made OptionParser interface more similar to that of Ruby
<crystal-gh> crystal/master e417c30 Ary Borenszweig: Fixed: pointers inside unions weren't correctly checked inside "if" conditions
<jhass> heh, not that OptionParser is a prime example of a nice interface :P
canhtak has quit [Quit: canhtak]
<travis-ci> manastech/crystal#2168 (master - be376b3 : Ary Borenszweig): The build passed.
bcardiff has joined #crystal-lang
the_asterite has joined #crystal-lang
<the_asterite> what would be a nicer interface?
<jhass> I like slop personally
<jhass> trollop is another popular alternative
<the_asterite> I just looked at them. They look nice, but they store everything in a big hash of mixed types, I don't think that goes well in Crystal. Plus with option parser you choose where and how to deal with each option. But it's true that in Ruby those things don't matter much
<jhass> well, do we have to store it that way?
<jhass> the conversion could happen on access, similar to pull parser
<jhass> or even be up to the caller really
<the_asterite> maybe. I think for now option parser is good enough :)
<jhass> yeah sure
<jhass> gotta leave room for a library eco system anyway :P
the_asterite has quit [Ping timeout: 264 seconds]
weskinner_work has joined #crystal-lang
ismaelga has joined #crystal-lang
weskinner_work has left #crystal-lang [#crystal-lang]
wanderer has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
asterite has joined #crystal-lang
ponga has quit [Quit: Leaving...]
shama has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eli-se has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
eli-se has quit [Quit: Leaving...]
leafybas_ has joined #crystal-lang
leafybas_ has quit [Remote host closed the connection]
leafybasil has quit [Ping timeout: 264 seconds]
ismaelga has quit [Remote host closed the connection]
eli-se has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
bcardiff has joined #crystal-lang
leafybasil has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
bcardiff has joined #crystal-lang
asterite has quit [Quit: Page closed]
ismaelga has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
wanderer has quit [Quit: Page closed]
eli-se has quit [Quit: Leaving...]