jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.7 | Fund Crystals development: http://is.gd/X7PRtI | 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
<nakilon> dudes
ledestin has joined #crystal-lang
<nakilon> such things that method without block call itself with &.itself -- this is why to get the perfomance you have to reimplement methods
<nakilon> stdlib methods
<nakilon> this reminds me Go and starts the question: Why not just write in C? ..(
<nakilon> implementing polymorphic methods by recursively adding parameters to itself looks fun and cool, but dudes, it makes it slow
kyrylo has quit [Ping timeout: 246 seconds]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<willl> all that gets inlined at compile time
waterlink has quit [Ping timeout: 244 seconds]
<willl> look at a benchmark https://gist.github.com/will/61074c7e56085a2323df there are no speeds to be gained by reimplementing out block calls
<willl> sorry made a mistake in the gist, one minute
<asterite> nakilon: check the Performance section here at the bottom: http://crystal-lang.org/docs/syntax_and_semantics/blocks_and_procs.html
<asterite> Also try to compile this with --release --emit llvm-ir: https://gist.github.com/asterite/e3cb8ee26c8c4d1ff873 . Then search "define i32 @foo()" in the generated .ll file and you'll see a nice `2` :-)
waj_ has quit [Read error: Connection reset by peer]
waj has joined #crystal-lang
fowlduck has joined #crystal-lang
<willl> asterite: does --release change the llvm-ir? I figured it just got sent through as opt_level = release ? LLVM::CodeGenOptLevel::Aggressive : LLVM::CodeGenOptLevel::None
waj has quit [Remote host closed the connection]
trapped_ has joined #crystal-lang
<crystal-gh> [crystal] will opened pull request #1401: Add Block Comment Syntax (master...block-comments) http://git.io/vZUS4
rossjones_ has joined #crystal-lang
thor77_ has joined #crystal-lang
tliff_ has joined #crystal-lang
thor77 has quit [*.net *.split]
trapped has quit [*.net *.split]
jokke has quit [*.net *.split]
rossjones has quit [*.net *.split]
tliff has quit [*.net *.split]
thor77_ is now known as thor77
jokke1 has joined #crystal-lang
tliff_ is now known as tliff
asie1 has joined #crystal-lang
_ has joined #crystal-lang
rvchangu- has joined #crystal-lang
_ is now known as Guest45342
[epitron] has joined #crystal-lang
asbradbu1y has joined #crystal-lang
rvchangue has quit [Ping timeout: 272 seconds]
asie has quit [Ping timeout: 272 seconds]
epitron has quit [Ping timeout: 272 seconds]
trapped_ has quit [Ping timeout: 272 seconds]
asbradbury has quit [Ping timeout: 272 seconds]
rvchangu- is now known as rvchangue
fowlduck_ has joined #crystal-lang
fowlduck has quit [*.net *.split]
lokulin has quit [Ping timeout: 265 seconds]
justinmcp_ has joined #crystal-lang
[epitron] has quit [Ping timeout: 265 seconds]
vegai has quit [Ping timeout: 265 seconds]
justinmcp has quit [Ping timeout: 265 seconds]
vegai has joined #crystal-lang
lokulin has joined #crystal-lang
waj has joined #crystal-lang
[epitron] has joined #crystal-lang
waj has quit [Remote host closed the connection]
fowlduck_ has quit [Remote host closed the connection]
trapped_ has joined #crystal-lang
fowlduck has joined #crystal-lang
Guest45342 has quit [Ping timeout: 244 seconds]
fowlduck has quit [Remote host closed the connection]
ylluminate has quit [Remote host closed the connection]
ylluminate has joined #crystal-lang
[epitron] is now known as epitron
epitron has joined #crystal-lang
epitron has quit [Changing host]
ylluminate has quit [Ping timeout: 268 seconds]
NeverDie has quit [Read error: Connection reset by peer]
NeverDie has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
ledestin has quit [Ping timeout: 255 seconds]
Ven has joined #crystal-lang
tatey_ has quit []
ylluminate has joined #crystal-lang
kyrylo has joined #crystal-lang
<crystal-gh> [crystal] will opened pull request #1405: Benchmark ips formatting improvements (master...benchmark-ips-formatting) http://git.io/vZTuq
BlaXpirit has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
elia has joined #crystal-lang
elia has quit [Client Quit]
tatey_ has joined #crystal-lang
<nakilon> $ crystal build --release 111.cr && time ./111
<nakilon> real0m0.158s
<nakilon> $ gcc 111.cpp -o ./111 && time ./111
<nakilon> real0m0.602s
<nakilon> _OO
BlaXpirit_ has joined #crystal-lang
<jhass> well, you didn't enable optimizations for gcc tbf ;)
<nakilon> gcc -O3 made 0.142s
Ven has joined #crystal-lang
BlaXpirit_ has quit [Quit: Konversation]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 240 seconds]
leafybasil has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
toydestroyer has joined #crystal-lang
DeBot has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
DeBot has joined #crystal-lang
wuehlmaus has quit [Quit: Lost terminal]
wuehlmaus has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
kyrylo has quit [Quit: Konversation terminated!]
kyrylo has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blassin has joined #crystal-lang
<blassin> hey, I don't understand the File#read error I'm getting here http://carc.in/#/r/e1p
<jhass> well that's indeed weird
havenwood has joined #crystal-lang
<blassin> I'll open an issue for it :(
Ven has joined #crystal-lang
<blassin> that's so bizarre, since I took the code from another project I'm working on (Crystal too) and it works there
<blassin> brb
ssvb has quit [Ping timeout: 260 seconds]
<jhass> blassin: http://carc.in/#/r/e24 I think it's because @content is nilable
<jhass> so essentially a misleading error message
<Netfeed> jhass: did you get commit bit in crystal-sqlite3 too? :P
<jhass> nope
<Netfeed> :(
<Netfeed> those pull requests is still not touched
<jhass> yeah, I'll ask asterite about them when he comes online
<Netfeed> nice
tatey_ has quit []
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
waj has joined #crystal-lang
<trapped_> i'm trying to test http://git.io/vZkdT using http://git.io/vZkdW but it seems like the spawn-ed code either hangs or does not execute at all
<jhass> Try UNIXSocket.pair
<jhass> I don't think StringIO blocks properly
<blassin> does anyone know how to turn a Slice(UInt8) into a Pointer(UInt8) ?
<BlaXpirit> blassin, to_unsafe
<blassin> no overload matches 'OpenSSL::SHA1::hash' with types Pointer(UInt8), Int32
<blassin> a valid overload is - OpenSSL::SHA1::hash(data : ::Pointer(UInt8), length : LibC::SizeT)
<blassin> what's ::Pointer ?
<BlaXpirit> blassin, :: is toplevel
<blassin> so this should work?
<BlaXpirit> usually it means nothing
<blassin> I mean, if I can turn the Int32 into a SizeT
<BlaXpirit> yes
<BlaXpirit> LibC::SizeT.cast(that)
<blassin> yeah, works now
<blassin> but my SHA1 hash is an array of numbers :/
<blassin> [74, 137, 17, 107, 151, 47, 209, 185, 158, 220, 81, 159, 157, 238, 120, 12, 231, 121, 55, 151]
<BlaXpirit> blassin, uhh it's the representation of Slice(UInt8)
<BlaXpirit> yeah, it's bad
<blassin> my code http://carc.in/#/r/e2r
<BlaXpirit> but that's what it is, a byte array, what did u expect
<blassin> a string?
<blassin> 03c3ec62b2c11aef22f0bd1fbd26d388fa6a883c ?
<BlaXpirit> that's usually called "hex digest"
<blassin> that's the one on HMAC
<blassin> but it requires a key there
<blassin> sha1sum on the CLI requires no key
<BlaXpirit> wat
<blassin> I wanna get the SHA1 sum of a Slice with 64KB of data
<blassin> basically, I'm trying to split files into 64KB chunks and SHA1 them
<jhass> blassin: .map(&.to_s(16)).join
<BlaXpirit> jhass, i don't think that's correct
<blassin> don't SHA1s always have the same amount of chars?
<blassin> I got one with less chars than the others
<BlaXpirit> blassin, really doubt it
<jhass> ah right, missing the 0's
<blassin> 0: 4a89116b972fd1b99edc519f9dee78ce7793797 1: 25348a991a334315fe7caa815b9b54ccc7dce9e 2: 40b585a84c2463116adb1afa392ec769c60 3: fd115a26a06faf9362964185ba741ee8f5ed81
<BlaXpirit> blassin, hashes are usually defined in bytes, anyway, you're getting bytes
<blassin> jhass: why is it missing the 0's ?
<jhass> oh, we got a .hex
<jhass> try calling .hex
<BlaXpirit> >> "%02x" % 3
<DeBot> BlaXpirit: # => "03" - http://carc.in/#/r/e2s
<jhass> wait, .hexstring actually
<BlaXpirit> you mean Slice#hexstring
<BlaXpirit> yes..
ssvb has joined #crystal-lang
<blassin> I got this http://imgur.com/gLPRl7z with this code http://carc.in/#/r/e2t
<jhass> blassin: yeah, we went past this by now, try .hexstring
<blassin> I did
<blassin> the code I listed uses it
<BlaXpirit> in the other place
<blassin> you mean for the sha var too?
<BlaXpirit> taking the hash part was good
<BlaXpirit> don't you understand that you're getting an array of bytes which is the hash
<blassin> I get it
<BlaXpirit> and you just want to display it as a hex string where each byte is represented by 2 characters
<blassin> just don't see how it's smaller in some cases
<blassin> if the sha.size is always 20
<BlaXpirit> so do sha.hexstring
<blassin> undefined method 'hexstring' for StaticArray(UInt8, 20)
<BlaXpirit> ok well this is a mess
<blassin> yeah, my feeling exactly :D
<BlaXpirit> whatever, sha.to_slice.hexstring
<BlaXpirit> >> [1, 2, 3, 255].map(&.to_s(16)).join
<DeBot> BlaXpirit: # => "123ff" - http://carc.in/#/r/e2v
<BlaXpirit> maybe this will help explain
<blassin> ah I see
<blassin> seems like I got it now http://imgur.com/AQJt6pV
<blassin> thanks!
waj has quit [Remote host closed the connection]
<BlaXpirit> feels to me like array, slice, staticarray should have more overlap
<blassin> yeah, me too
<BlaXpirit> maybe one inheriting the other... but 3 unrelated classes is too much
<BlaXpirit> maybe Enumerable isn't good enough
<BlaXpirit> and there should be a module for random access collections
<BlaXpirit> because array is getting too fat
<BlaXpirit> or maybe it's that StaticArray should be just for internal use
<jhass> yeah, we briefly discussed Indexable before
<trapped_> is a `.should eq` failure supposed to print this https://gist.github.com/trapped/717ec802c5c046ad9c04
trapped_ is now known as trapped
<BlaXpirit> trapped, hmm are you sure you're doing it with proper wrappers?
<blassin> so, with 0.7.6 removing File#read with a length, is there anyway now to read X bytes from a file?
<jhass> trapped: yes
<BlaXpirit> you need to have describe, it and inside it do the assertions (should, whatever)
<jhass> >> "foo" == "foo\r\n"
<DeBot> jhass: # => false - http://carc.in/#/r/e2w
<trapped> yeah i do have those, BlaXpirit
<BlaXpirit> i thought the questio was about backtrace, not about \r\n
<jhass> blassin: your Slice should have that size of what you want to read iirc
<trapped> well it's inside a spawn that's inside an it do block
<blassin> I assumed #read onto a slice of N bytes size would truncate it a N bytes if you read more, but it resizes the Slice...
<trapped> about backtrace
<trapped> i mean, if the .should assertion fails, why does it print the backtrace?
<BlaXpirit> trapped, oh that could definitely explain it
<BlaXpirit> trapped, because separate fiber has different stack
<trapped> yeah that's what i was thinking
<BlaXpirit> i think exceptions cant work thru fibers
<blassin> jhass: my Slice does
<BlaXpirit> if your fiber throws, the program throws
<blassin> but .read onto it with more bytes resizes it
<BlaXpirit> terminates
<BlaXpirit> and all that really happens is... .should raises an exception and `it` catches it
<BlaXpirit> since you raise that exception in a different fiber, it breaks
<jhass> blassin: https://github.com/manastech/crystal/blob/master/src/io/buffered_io.cr#L154 I'm missing where it would resize it unless there's not enough left to read
<blassin> so it's a feature and not a bug?
NeverDie has joined #crystal-lang
<BlaXpirit> blassin, well i wouldnt say it's a feature
<BlaXpirit> wait, what exactly do you mean
<BlaXpirit> yeah, i would be really surprised if it resized the slice
<BlaXpirit> if that's even possible, cuz i think it's immutable
<blassin> I dunno - I would expect a Slice of size X to get full with Y bytes if Y > X
<blassin> I meant to get full with X bytes
<blassin> so, if the Slice is 20K, if I read 21K onto it, the Slice contains bytes 0-20k
<blassin> right?
<jhass> if your file is 21K, the first call should fill it with 20K and the next call with 1K, as I understood it
<blassin> I do a seek on every loop iteration
<blassin> f.seek( current_partition * @chunk_size, IO::Seek::Set )
<blassin> (to the next chunk of @chunk_size bytes)
<BlaXpirit> uhhh why..?
<jhass> that might mess up the buffer
<blassin> my rationale was seek to 0 -> fill slice 1
<jhass> (the internal one of File/BufferedIO)
<blassin> seek to X * chunk_size -> fill slice X
<BlaXpirit> blassin, but read advances the position
<blassin> I was counting on that :D
<jhass> you were? why seek then?
<blassin> seek -> read(slice)
<blassin> ok
<blassin> there's 256K on the file, and I want 64K slices
<blassin> so while looping, create a 64K Slice s, seek F to n_loop_iteration * 64k, F.read(s)
<blassin> is it so strange?
<BlaXpirit> yes
<BlaXpirit> because u simply dont need the seek
<blassin> doesn't #read read the whole file?
<blassin> I thought it did, so I reset the position
<jhass> no
<jhass> not if you pass a slice or length
<blassin> it seems to me that it does, because all my slices are 256k in size now
<blassin> read doesn't take a size anymore, right? (0.7.6)
<BlaXpirit> i have no idea what's happening anymore
<BlaXpirit> sounds surreal
<blassin> I don't know why I can't seem to make myself understood :/
<blassin> I thought this code is self-evident http://carc.in/#/r/e2y
<BlaXpirit> thats too complex for me
<blassin> it *should* (in my mind) create 4 64k sized files for a 256k input
<blassin> but all the slices are 256k now
<blassin> and the slice is always set at 64k
<blassin> I mean, why set the Slice size if a read grows it anyway? seems odd to me
<BlaXpirit> i think you're confused.
<blassin> I know I am :D
<BlaXpirit> it's possible that you're correct, but you'd have to prove it with a small example
<BlaXpirit> eh i mean i can try to write such an example easily
<blassin> ok, instead of f.seek now I do f.pos = current_partition * @chunk_size
<jhass> seems to work fine?
<BlaXpirit> jhass was faster, of course
<blassin> interesting
<blassin> so why are my slices 256k ?
<jhass> idk
<jhass> maybe the way you inspect that is wrong?
<jhass> can't meditate on your code atm, too much other stuff going on
shadeslayer has quit [Ping timeout: 246 seconds]
shadeslayer has joined #crystal-lang
dyulax has joined #crystal-lang
Ven has quit [Ping timeout: 244 seconds]
<blassin> BlaXpirit: managed to fix it, FWIW http://carc.in/#/r/e3n
<blassin> thanks for the help! (and to jhass as well, as always :D)
<jhass> ah, doesn't loop yield an index in fact?
<BlaXpirit> it does
<blassin> it does?
<BlaXpirit> >> loop do |i|; p i; break; end
<jhass> >> loop {|i| print i; break if i > 5 }
<DeBot> jhass: in line 4: undefined method '>' for Nil - http://carc.in/#/r/e3o
<DeBot> BlaXpirit: nil - more at http://carc.in/#/r/e3p
<BlaXpirit> nope :D
waj has joined #crystal-lang
<jhass> too bad
<blassin> yeah, I had to find a replacement :D
<BlaXpirit> well that's a very bad one
<jhass> >> Float::INFINITY.times {|i| print i; break if i > 5 }
<DeBot> jhass: Error in line 4: undefined constant Float::INFINITY - http://carc.in/#/r/e3q
<jhass> >> Float32::INFINITY.times {|i| print i; break if i > 5 }
<DeBot> jhass: Error in line 4: undefined method 'times' for Float32 - http://carc.in/#/r/e3r
<jhass> :(
<blassin> I don't do times
<BlaXpirit> no no, this is very bad
<BlaXpirit> you add 1.0 every time
<BlaXpirit> basically
<jhass> actually not
<BlaXpirit> and that can go into an infinite loop under crazy circumstances
<jhass> it's Range(B,E)
<BlaXpirit> hmmmm maybe you're right
<jhass> so it goes into Int#succ
<jhass> and any_int < FloatXX::INFINITY
<blassin> BlaXpirit: still think it's a very bad replacement?
<BlaXpirit> nice
<blassin> it's ok, right?
<blassin> right? :D
<BlaXpirit> just bad, not very :p
<blassin> I don't see why, kindly explain?
<jhass> you could probably (f.size/@chunk_size).ceil.times do |i| or so
<BlaXpirit> actually .fdiv :(
<jhass> ah, right
havenwood has quit [Ping timeout: 240 seconds]
<BlaXpirit> this is one of the worst things about crystal
<BlaXpirit> for me, anyway
<blassin> what, fdiv ?
<BlaXpirit> the fact that division acts differently in different situation
<BlaXpirit> not fdiv, but the need for fdiv
<BlaXpirit> python devs realized it was a mistake back in 2001
<BlaXpirit> but this behavior is still the default in 2.x
<blassin> BlaXpirit: yeah, the infinity thing is bad when you know the iterations...
<BlaXpirit> blassin, no, it should just be a while loop
BitPuffin has joined #crystal-lang
<BlaXpirit> and honestly what prevents you from wrapping this
<blassin> I thought whiles were bad practice and loop do was the thing
<BlaXpirit> >> def count; i = 0; while true; yield i; i += 1; end; end
<DeBot> BlaXpirit: Error in line 4: can't declare def dynamically - http://carc.in/#/r/e3s
<BitPuffin> hello does crystal come built in with manual memory management, I was checking the docs with the pointer class but the malloc there seems to still allocate GC memory
<BlaXpirit> i have no idea where the error is
<jhass> BlaXpirit: mmh, but given we don't autogrow integers it kinda feels more consistent that way too, no? having the lower level/more manual behavior in all cases
<BlaXpirit> oh, jhass, that's a problem with this wrapping :o
<jhass> BitPuffin: not really, there are some ways to disable GC and go manual, but the language is absolutely not designed for that, those avenues are rather for interfacing with C libraries
<jhass> BitPuffin: using stdlib that way will probably quickly lead to leaks
<BitPuffin> jhass: ah too bad, was hoping that the language would be a bit more full spectrum
<BlaXpirit> blassin, http://carc.in/#/r/e3t
<BitPuffin> jhass: still it seems like a cool lang
<BlaXpirit> though honestly, i think loop should yield the index
<jhass> BitPuffin: thanks :)
<BlaXpirit> unless it actually doesn't get optimised if unused
<blassin> I think (f.size.to_f / @chunk_size).ceil.to_i.times do |i| in this case is better
<jhass> it should, the block gets inlined thus it becomes a local var that's never read
<blassin> since the loop has bounds
<jhass> it's like the prime example for optimization
<blassin> I also think #ceil should make it an Int
<BlaXpirit> there are a lot of things that perhaps shouldn't blindly follow ruby
<BlaXpirit> oh actually ruby returns an int
<BlaXpirit> :|
rossjones_ is now known as rossjones
<BitPuffin> jhass: do you think there will be more work on more low level stuff in the future, or will it mainly remain a pretty high level-only language. To me as a game developer I think it's attractive to be able to mix high level code and really really low level code in the same language
<BlaXpirit> blassin, the problem is the int can be too big
<BlaXpirit> in ruby it's not a problem because i think its numbers are unlimited
<blassin> aww right
<blassin> but wait, it could be a Int64
<BitPuffin> BlaXpirit: woot ruby uses bignums by default?
<blassin> when called on a Float64
<BlaXpirit> blassin, int64 is much much smaller
<BlaXpirit> float goes up to like 10^300
<BlaXpirit> and int is just 10^18
<BlaXpirit> (all approximate)
<BlaXpirit> by int i mean uint64
<blassin> how can floats in 64 bits be bigger than ints in 64 bits? unless Floats skip a lot of fractions...
<BlaXpirit> blassin, precision is lost
<blassin> I mean, UInt64 of course
<blassin> BlaXpirit: I see, yeah that would be the only way
<BlaXpirit> it stores it like 1.23456789012345 * 10^300
<jhass> BitPuffin: I don't see changes to memory management, that's just affecting the language design too much. You can already embed assembler and we have quite beautiful C library interfacing
<BlaXpirit> (oversimplified)
<blassin> BitPuffin: I think Crystal has a bright future in gamedev
<blassin> due to its performance and easy of writing
<jhass> BitPuffin: Ruby autogrows Fixnum to BigNum on overflow
<blassin> I mean, once the .... substantial wrinkles :D are ironed out
<BlaXpirit> jhass, no but garbage collection can bite you
<blassin> *ease of writing
<BlaXpirit> if there is a way to manually invoke garbage collection when you want, then it's all good
<BlaXpirit> otherwise you can't say there are no problems
<blassin> I think *serious* gamedev keeps an eye on object allocation count
<blassin> that kinda mitigates GC issues
<BlaXpirit> then again a ton of games are written in c#
<BlaXpirit> which is garbage collected
<BitPuffin> blassin: maybe if you mix it with C or something then. But on its own probably not, though I guess it could work for the type of games where C# is sufficient, but for larger games probably not
<blassin> I think a lot of big games are written in C#
<blassin> maybe not FPSs
<blassin> but for sure big codebases
<BlaXpirit> oh FPSs too, why not
<BitPuffin> most games written in C# are Unity games
<BlaXpirit> yes
<BlaXpirit> and their performance sucks usually
<BitPuffin> yep
<blassin> well, I see FPSs as hugely optimized ASM codebases :D
<BlaXpirit> but you can't say it can't be done
<BitPuffin> FPS has little to do with it
<BitPuffin> or do you mean first person shooter
<BitPuffin> :P
<blassin> I think because a lot of Unity games use JS for component logic instead of C#
<BitPuffin> You wouldn't write say The Witcher 3 in C#
<BlaXpirit> blassin, what changes because of that?
<BlaXpirit> JS is much slower btw
<blassin> I see JS as more problematic (performance wise) than C#
<BlaXpirit> ok
<blassin> might give Unity games a bad rep
<BitPuffin> the JS in unity is not even Javascript
<BlaXpirit> oh yeah, thanks for reminding me why i avoid Unity at all costs
<blassin> but OTOH there's a lot more code to learn from in JS
<BitPuffin> it's pretty much as fast as C#, as it just becomes mostly equivalent CLR IR
<BitPuffin> it's technically called "UnityScript"
<blassin> I like tools like Unity
<blassin> gives people power
<blassin> POWER TO THE PEOPLE :D
<BitPuffin> I use unity for my day job and it sucks :P
<blassin> even if the frame rate sucks, they move on to bigger things
<BitPuffin> it's relatiely ok for prototyping
<blassin> BitPuffin: in absolutely terms, yeah maybe it sucks - but it's a great tool for n00bs
<BitPuffin> yeah, and prototyping :P
<blassin> and for quick protos
<blassin> yeah
<BitPuffin> but too many people choose the engine for quite ambitious projects
<BitPuffin> I wouldn't have chosen this engine for the project I'm paid to work on
<blassin> usually n00bs are ambitious :D
<BitPuffin> yeah that's true
<blassin> first project: pong, second: The Witcher IV with better graphis
<blassin> *graphics
<BitPuffin> Fairly accurate :P
<blassin> I see that with the coders I coach for Rails work
<blassin> first thing: a "blog"
<blassin> second: Facebook with video chat
<BitPuffin> hehe
<blassin> (actually happened)
<BitPuffin> yeah not doubting that
<blassin> it's what you get when n00bs get instantly empowered
<blassin> a fine line to thread on for educators :/
<BitPuffin> that's why you give the noobs C xD
<blassin> I kinda prefer coaching them on web basics first now
<blassin> as to get them to understand "scope"
<BitPuffin> let them leak all of the memory
<BitPuffin> _all_ of it
<BitPuffin> when you add * to a struct type you get a Pointer(StructType) ?
<jhass> yes, Foo* is syntax sugar for Pointer(Foo)
<jhass> regardless whether Foo is a struct, class or C struct
<jhass> or enum even I guess
<BitPuffin> if you call out to C malloc does the returned pointer then bypass the GC? so that I can free it manually with C free
<jhass> yes
<BitPuffin> hmm
<jhass> the GC integration is not all that complicated
<BitPuffin> I guess then you probably could call out to C a minimal amount and manage your own memory
<BitPuffin> without the GC "trying" to gc it
<jhass> yes, that's what I meant with there are ways around it. It just doesn't fit well into the language
<BitPuffin> right
<jhass> also keep in mind that struct (everything descending from Value in fact) is stack allocated
<BitPuffin> you'd probably have to write sort of an alternative stdlib I guess if you want to for example stay entirely GC free
<BitPuffin> Yeah I noticed that
<BitPuffin> unless you use a Pointer(Value)
<BitPuffin> well, allocate with that
<jhass> yup
<BitPuffin> you can get a pointer to a stack thingy
<BitPuffin> I guess the problem then becomes that there's no way to really implement your own smart pointers for example if you want something close to GC but not entirely like GC, then again C doesn't let you do that either so not much lost :)
<BitPuffin> was just thinking compared to other fairly low-level focused languages
<jhass> dunno, maybe you actually could hook into the GC callbacks
<BitPuffin> yeah but then you're still using the GC :D
<jhass> no check my link to the null GC
<BitPuffin> I guess I meant something somewhat concrete and predictable like oh this method is always called when you go out of scope etc
<BitPuffin> oh! that was another GC? din't know it was "pluggable"
<jhass> mmh, but yeah we actually don't have "out of scope" hooks
<jhass> just allocation hook
<jhass> s
<jhass> but yes it's pluggable and essentially down to defining the functions you see at the top
<BitPuffin> can you use different GC per object? :P
<jhass> you could override it's new with and not call allocate I guess
<BitPuffin> ah, so that's per type then, not per instance
<BitPuffin> unless you make a constructor that takes a GC or something
<jhass> yeah or different .new's
<jhass> could monkeypatch those into Reference even I guess
<jhass> (crystal has an open class model)
<BitPuffin> well actually, couldn't you just have a generic method or something in the GC that will allocate the type in that specific GC?
<BitPuffin> and call initialize for you
<jhass> but yeah, .new boils down to def self.new(*args); obj = allocate; obj.initialize; obj; end;
<jhass> and I guess allocate boils down to def self.allocate; __crystal_malloc(sizeof(self)) as self or something
Renich has joined #crystal-lang
<BitPuffin> yeah, so if you instead say (don't know this language so excuse my pseudo-syntax) MyGC.create<Foo>()
<BitPuffin> which does the allocate step for you, and calls Foo.initialize
<jhass> problem with that is that it'll return a union of all types you call it for
<BitPuffin> oh :P
<BitPuffin> so it's not like templates then it's some weird single function thing
<jhass> yeah there are no generic functions. Yet.
<jhass> only generic classes (and structs)
<jhass> mmh, or actually
havenwood has joined #crystal-lang
<BitPuffin> ah so when you'd add generic functions the above would work?
<jhass> >> def foo(foo : T); T.new; end; foo(Array(String)); foo(Array(Int32)); typeof(foo(Int64))
<DeBot> jhass: Error in line 4: can't declare def dynamically - http://carc.in/#/r/e4g
<jhass> >> def foo; 1; end; foo
<DeBot> jhass: Error in line 4: can't declare def dynamically - http://carc.in/#/r/e4h
<jhass> :(
<BitPuffin> hahaha
<jhass> asterite: ^ let's whitelist def inside begin/rescue again :P
<jhass> BitPuffin: so, actually we do have generic methods I guess :P http://carc.in/#/r/e4l
<jhass> mmh, now I'm confused, I expected this to be a union http://carc.in/#/r/e4m
<BlaXpirit> jhass, :o
<BlaXpirit> the union thing applies only to instance variables
<jhass> lol, no
<BlaXpirit> well ok, not "only"
<BitPuffin> o_O
<BlaXpirit> but yeah, these functions are instantiated for each type they're called with
<BlaXpirit> separate machine code is generated
<jhass> >> def foo; [1, "f"].sample; end; typeof(foo)
<DeBot> jhass: Error in line 4: can't declare def dynamically - http://carc.in/#/r/e4n
<jhass> sigh
<jhass> I need to fix the bot on .6 I guess
DeBot has quit [Quit: Crystal IRC]
DeBot has joined #crystal-lang
<jhass> >> def foo; [1, "f"].sample; end; typeof(foo)
<DeBot> jhass: # => (String | Int32) - http://carc.in/#/r/e4o
<jhass> better
<BlaXpirit> but what did u change in the bot?
<jhass> run on .6 instead of .7
<BlaXpirit> oh :p
blassin has quit [Quit: Page closed]
<BitPuffin> why does it do that union thing exactly?
<BlaXpirit> BitPuffin, which union thing?
<BitPuffin> why does it union the return type of generic uh, was it instance methods?
<BitPuffin> the thing you guys were discussing with unions just now :P I don't know this language
<BlaXpirit> BitPuffin, it's instance variables and globals that are union-ed like that
<BitPuffin> but why?
<BlaXpirit> i think the docs explain it clearly
<BitPuffin> where should I look in the docs, generics?
<BlaXpirit> this is definitely not about generics
<BlaXpirit> docs should be read entirely and sequentially
<BlaXpirit> (about 5 times, in my case)
<BitPuffin> Well I haven't yet decided to invest a lot of time in this language :P I'd like to know why it does this particular thing
<BitPuffin> I do understand most of it though since it's concepts I'm familiar with and I know ruby though it was a long time since I used it
<BlaXpirit> BitPuffin, docs are very concise and really flare your interest
<BlaXpirit> it's like an hour's read tops
<jhass> >> foo = if 1 == 2; "foo"; else; :foo; end; typeof(foo)
<DeBot> jhass: # => (String | Symbol) - http://carc.in/#/r/e4w
<jhass> locals too
<BlaXpirit> yes..
<BitPuffin> BlaXpirit: ah that's good :)
<jhass> BitPuffin: everywhere where something could either have type A or type B, the type inference creates a new type A|B which you can only call common methods on or need to resolve using .is_a? and similar. That's called a union
<BitPuffin> yeah I know what unions are
<BitPuffin> I was just confused why it would opt for unions rather than generating functions
<BitPuffin> I guess in order to avoid code bloat or something?
<jhass> well it looks like I was mistaken on that, sorry
<BitPuffin> ah I guess this has more to do with error checking rather than code gen
<BlaXpirit> uhh no
<BlaXpirit> it can't branch off into entirely different functions every time there is a branch in code
<BlaXpirit> and the types are often only known at runtime anyway
<BitPuffin> well no not every time there's a branch in code
<BitPuffin> but in the case of generic types you can
<BlaXpirit> BitPuffin, do you know what generics are in other languages? (if so, name one you're familiar with)
<BitPuffin> well I believe the difference between templates and generics are basically that generics don't generate code for each type instance
<BitPuffin> but some languages have started doing that anyway and still call it generics
<BitPuffin> I believe Nim's generics are actually more like templates for example, but they still call them generics.
<BitPuffin> I guess in order to avoid the terror in people's hearts when they hear the word templates
<BlaXpirit> BitPuffin, oh if you know Nim, then the situation in case of function arguments is the same here
<BitPuffin> I haven't kept up with Nim, I used to use it a bit when it was still nimrod
<BlaXpirit> you don't have to specify types in functions at all. every instantiation of a function will generate separate code
<jhass> actually we do have fun's and it's especially not true for them :P
<BitPuffin> I don't think Nim does RTTI, unless you create an ADT
<BlaXpirit> :|
<jhass> >> fun foo(a); a; end; foo(1); foo("foo"); typeof(foo(:foo))
<DeBot> jhass: Syntax error in eval:4: expecting token ':', not ')' - http://carc.in/#/r/e5e
<jhass> right and no type inference there either I guess
<BitPuffin> they do have type inference
<jhass> I mean funs
<BitPuffin> ah
<BitPuffin> :P
<BlaXpirit> waaaaait a second
<BlaXpirit> what is `fun` and why do i not know this
<BitPuffin> but yeah so what I mean is that if I do something like this in nim: `proc foo[T](a T): T = ...`
<BitPuffin> then each call to foo will generate a new function
<BitPuffin> well
<BitPuffin> not each call
<BitPuffin> but each different type for a
<BlaXpirit> def foo(a: T): T
<BlaXpirit> i think this is equivalent crystal
<jhass> BlaXpirit: it generates a function, very similar (I think the goal is to be compatible) with what a C function would generate
<BlaXpirit> but u can also just write def foo(a)
<BitPuffin> so if I call that foo(1) and foo("hello") it will not create a union?
<BlaXpirit> no
<BitPuffin> oh wait yes we talked about that
<jhass> their names don't get mangled
<BitPuffin> the functions/methods are "generic" (but actually more like, templated)
<BitPuffin> is that true for instance methods too?
<jhass> eh, well it will create union for the scope of the method
<BlaXpirit> BitPuffin, yes, instance methods don't differ much
<jhass> >> def foo(a); typeof(a); end; foo(1); foo("foo")
<DeBot> jhass: # => String - http://carc.in/#/r/e5f
<jhass> but..
<jhass> >> def foo(a); a.upcase; end; foo(1); foo("foo")
<DeBot> jhass: in line 4: undefined method 'upcase' for Int32 - http://carc.in/#/r/e5g
<jhass> everything I thought I would have understood ...
<jhass> >> def foo(a); puts typeof(a); end; foo(1); foo("foo")
<DeBot> jhass: Int32 - more at http://carc.in/#/r/e5h
<BlaXpirit> hahahaaa this will happen once in a lifetime. i understand something better than jhass
<BitPuffin> I think I'm both more confused and more informed than when we started :P
<jhass> mmh, I guess I wrongly pictured that behavior as a union, handling it is the same anyway
<BlaXpirit> BitPuffin, read the docs already :p
<BitPuffin> I did read that thing :P
<BlaXpirit> jhass, in this case 2 separate functions are generated
<BlaXpirit> foo-for-int32 and foo-for-string
<jhass> yeah, realized that now
daveshah has joined #crystal-lang
<BlaXpirit> BitPuffin, don't worry about these unions. basically if we compare it to Nim, the situations in which unions appear wouldn't even be possible to achieve in Nim
<BitPuffin> okay so, if you have a class with an instance variable, that will become a union for all the different types you initialize it with, and then each method that uses that variable and returns something which has little to do with the type of the instance variable itself but is a fairly concrete value that you can get from pretty much any version of the instance variable because that type has a method shared between all tho
<BitPuffin> the same thing, then you'll get a generated method for each type of that instance variable?
<BlaXpirit> because in most compiled languages you have to specify the type of a variable and it never changes (and unions are annoying to work with)
<BitPuffin> but of course, if you retern the variable itself then I guess you'd need to get the union, because it could be many different things
<BitPuffin> that was worded horribly :P but I hope it made sense?
<BlaXpirit> BitPuffin, i think there will be only one method generated, only for the union
<BitPuffin> hmm
<BitPuffin> ah maybe
<BitPuffin> but okay
<BitPuffin> so say I have def foo(a)
<BitPuffin> and foo uses the union'd instance variable
<BitPuffin> I do get a different foo for each type of a I pass right?
<BitPuffin> (codegen wise)
<BlaXpirit> BitPuffin, there are compiletime types and runtime types
<BlaXpirit> the type Int32|Int64 is a compile time type. it can hold runtime values of types Int32 or Int64
<BitPuffin> but basically crystal seems to be doing implicit ADTs
<BlaXpirit> but if you pass a value that has a compiletime type Int32|Int64 then that's the type that the function will be generated for
Ven has joined #crystal-lang
<BlaXpirit> BitPuffin, maybe this will help http://carc.in/#/r/e5o
<BlaXpirit> this conditional serves the same purpose as an instance variable that was once assigned int32 and once int64
<BlaXpirit> typeof is compiletime type, .class is runtime type
<BitPuffin> pp = prettyprint?
<BlaXpirit> BitPuffin, yeah, it's like a debug print
<BitPuffin> yeah
<BlaXpirit> basically prints "the literal piece of code that you wrote" = "the actual value"
<BitPuffin> so in the case when you're passing a, you are passing something which has the type of that union
<BitPuffin> so the version that takes that union is the one you get
<BitPuffin> but that's a different generated method than the one for only Int32 right?
<BlaXpirit> yes, BitPuffin
<BlaXpirit> basically there are as many generated methods as there are different typeof outputs
<BlaXpirit> i may be mistaken though
ssvb has quit [Ping timeout: 272 seconds]
shama has joined #crystal-lang
Renich has quit [Ping timeout: 272 seconds]
<trapped> for some reason, the 2nd test fails (http://lys.pellero.it/trapped/maild/builds/39) with "Broken pipe" but the others don't https://github.com/trapped/maild/blob/master/spec/maild/smtp/smtp_spec.cr
<BitPuffin> BlaXpirit: alright it seems pretty clear to me now, thanks for the discussion
<BitPuffin> I guess we could look at generated assembly if we wanted to check if it actually creates a new method :P
<BlaXpirit> BitPuffin, or generated LLVM code
<BitPuffin> yeah true
<BitPuffin> hmm whitequark
<BitPuffin> where have I seen that nick before
<BlaXpirit> BitPuffin, uh it's just the irc logger
<BitPuffin> ah, well I think I've been in an irc channel where someone is actually called that and speaking like a human
<BlaXpirit> jhass, wasn't there a way in carc.in to show llvm-ir ?
<BlaXpirit> there should be
<jhass> nope
ssvb has joined #crystal-lang
<jhass> it'd introduce a whole deal of language specific options and preferably generically describing them and rendering UI for them
<jhass> if somebody wants to contribute that, I'm not opposed
<jhass> but it's more effort than I'm willing to spend atm
<BitPuffin> well now I just need to come up with an excuse to toy with this language
<BlaXpirit> right, you wanna keep it elegant :p
<BitPuffin> hrm
<jhass> also --emit llvm-ir writes a file, not stdout, so you'd need to read that out of the container and shit
<BlaXpirit> o.o
<nakilon> lambdas don't see variables declared outside? (
<BitPuffin> pretty sure a talk I listened to mentioned that they do
<nakilon> ahm ok
<jhass> >> foo = 1; proc = -> { foo + 1 }; a = proc.call; foo += 1; b = proc.call; {a, b}
<DeBot> jhass: # => {2, 3} - http://carc.in/#/r/e5r
<jhass> yup
<jhass> totally closures
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<BitPuffin> oh what's the license of crystal btw
<jhass> Apache 2
<BitPuffin> hm
<BitPuffin> okay
<BitPuffin> I guess that works
<BitPuffin> at least it ain't gpl :)
<jhass> yeah, it doesn't infect any code you write or the binaries generated afaik
<BitPuffin> no I believe it doesn't
<jhass> basically MIT + patent waiver
<BitPuffin> I wonder how it manages to be so long then
<BitPuffin> anyway, I usually go CC0 because I'm a public domain freak
<jhass> patent law sucks :P
<jhass> even the full CC0 is quite long
<jhass> since you can't legally give up your copyright (well, not the right term always but the best english has) in some countries
<BitPuffin> Yeah, it is pretty long
<BitPuffin> but it is possible to read it to the end without dying
<jhass> just grant all usages
<BitPuffin> ideally I'd like to just say "this software is public domain" or something short like that
<BitPuffin> but then I'd be alienating some countries
<jhass> if there's something like that forbidding military use I'd probably opt for that
kyrylo has quit [Ping timeout: 244 seconds]
<BitPuffin> though sometimes I say something like "This software is public domain but if that's not sufficient you may use CC0 (see CC0.txt in project root)"
<BitPuffin> that way I can be both an idealist and pragmatist all in one
Ven has joined #crystal-lang
<BitPuffin> jhass: I don't see a reason to legally try to enforce what anyone can do with things I make public
<jhass> you don't want to know how much OSS is in the US drones ...
<BitPuffin> probably a hole ton
<BitPuffin> but like
<BitPuffin> otherwise they'd just put proprietary code in there :P
<BitPuffin> and that they might contribute some bugfixes upstream to OSS as a result of using OSS is better than them writing their own proprietary code or something
<BitPuffin> I dunno
<BitPuffin> I'd rather have them not have the drones of course
<BitPuffin> but I don't think preventing them from using your code will achieve that
<jhass> sure, but why not make them burn as much money in the process as possible. No reason I should make it easier or more economic for them
<BitPuffin> ehh, you don't really want to feed the mililitary industrial complex with even more reasons to raise their budget
<BitPuffin> but yeah I see your reasoning a little bit, but I don't think that's the way to stop them
<jhass> it's not about stopping them really
<BitPuffin> it's about giving them the finger? :)
<jhass> there's a huge ethical component to your code supporting murder
<BitPuffin> not really, the responsibility is on the person using the code for killing
<jhass> that's the old anit gun law logic
<BitPuffin> you mean guns don't kill people people do?
<jhass> yes
<jhass> I don't fully agree with it
<BitPuffin> well it's pretty true at least
<BitPuffin> also guns are a much more direct way of killing someone
<BitPuffin> than code
<jhass> but there's no reason to make it as hard as possible
<jhass> *not to make it
<jhass> sigh
<BitPuffin> sure there is, you're supporting copyright / patent law which is terrible
<BitPuffin> and makes things complicated
<jhass> copyright is a terrible term :/
<jhass> german law has a nicer definition there, basically the "rights of the creator"
<jhass> which you can't give up
daveshah has quit []
<jhass> so as a German I'm only granting usage rights, one being the right to copy at all, I can't give up my "rights of the creator" though
<jhass> and all I'm saying is that I don't want to give out those usage rights to military purposes
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZLtm
<crystal-gh> crystal/master 918b655 Ary Borenszweig: Added `ArrayLiteral#includes?(obj)` in macros
<trapped> for some reason, the 2nd test fails (http://lys.pellero.it/trapped/maild/builds/39) with "Broken pipe" but the others don't https://github.com/trapped/maild/blob/master/spec/maild/smtp/smtp_spec.cr
BitPuffin has quit [Ping timeout: 240 seconds]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
ponga has joined #crystal-lang
leafybasil has quit [Ping timeout: 240 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<BitPuffin> jhass: Yeah I think sweden has a similar thing probably. Where you can grant usage rights and even waive copy rights probably but you can't remove yourself as the "author" sort of
BitPuffin has joined #crystal-lang
<jhass> you broke my weechat oO
<BitPuffin> jhass: Yeah I think sweden has a similar thing probably. Where you can grant usage rights and even waive copy rights probably but you can't remove yourself as the "author" sort of
<BitPuffin> (sorry if I sent this 3 times before I'm having connectivity issues)
blue_deref has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
kyrylo has joined #crystal-lang
<BitPuffin> jhass: anyway I sympathize with your aspirations to prevent military use but I think in the end it is probably harmful in other ways as it enables things that you might for example not want to exist and suddennly you're relying on evil to prevent evil
<BitPuffin> and then you find yourself unable to remove an evil because that will enable the evil you wanted to prevent earlier
<BitPuffin> that's what I think anyway
kulelu88 has joined #crystal-lang
<BitPuffin> I guess sometimes using a lesser evil to prevent a greater evil is a valid compromise depending on how much of an idealist you are :)
<dyulax> symbols does not respond to "object_id"... is it a bug or there is a reason for this?
<BlaXpirit> >> [1].object_id
<DeBot> BlaXpirit: # => 155840400 - http://carc.in/#/r/e5v
<BlaXpirit> >> 1.object_id
<DeBot> BlaXpirit: Error in line 4: undefined method 'object_id' for Int32 - http://carc.in/#/r/e5w
<BlaXpirit> dyulax, i suppose object id returns the value of the pointer
<jhass> >> struct Foo; end; Foo.new.object_id
<DeBot> jhass: Error in line 4: undefined method 'object_id' for Foo - http://carc.in/#/r/e5x
<BlaXpirit> there is no pointer in value types
<BlaXpirit> >> class Foo; end; Foo.new.object_id
<DeBot> BlaXpirit: # => 149118960 - http://carc.in/#/r/e5y
<BlaXpirit> >> :asdf .to_i
<DeBot> BlaXpirit: # => 1 - http://carc.in/#/r/e61
<BlaXpirit> >> [:a, :b, :c].map &.to_i
<DeBot> BlaXpirit: # => [1, 2, 3] - http://carc.in/#/r/e63
<BlaXpirit> dyulax, if u really for some reason need this, then check this out
<BlaXpirit> >> [:b, :a, :b].map &.to_i # finally realized how to make this example good
<DeBot> BlaXpirit: # => [1, 2, 1] - http://carc.in/#/r/e66
<jhass> >> %i(a b a).map &.hash
<DeBot> jhass: # => [1, 2, 1] - http://carc.in/#/r/e67
* BlaXpirit would never ever use this literal
<dyulax> my issue is that a C function requires a UInt64... in a Ruby binding for this function, they use xxx.object_id and work with symbols everywhere... in Crystal symbol is not an object, so I guess I won't allow it
<BlaXpirit> dyulax, please don't make this an XY problem :p
<dyulax> what is a XY problem?
<jhass> ?xy
<DeBot> jhass: Nothing known about xy.
<jhass> aw
<jhass> let me steel one
<jhass> er, steal even
<BlaXpirit> ?xy=The XY problem is asking about your attempted solution rather than your actual problem.
<DeBot> BlaXpirit: Set xy.
<jhass> ?foo=it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<DeBot> jhass: Set foo.
<jhass> right, it's not my day
<jhass> ?xy=it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<BlaXpirit> foo?
<DeBot> jhass: Set xy.
<jhass> I said it's not my day
<BlaXpirit> i dunno, the other one is short and to the point
<dyulax> So this is my problem: I have shapes that collide if they are in the same "layer"... so I assign them to a layer 1, 2, 3.. whatever.. and they only check for collision in the same layer. What I want to do is inform a symbol instead of a number (since they are more descriptive), but I can't convert a symbol into some kind of number.
<dyulax> shape.layer = :background instead of shape.layer = 0
<dyulax> under the hood it will call a C function that REQUIRES a number
<trapped> is this supposed to be right http://carc.in/#/r/e60
<trapped> i would've expected the clone's instance variables to remain the same
n0xff has quit [Ping timeout: 264 seconds]
<jhass> trapped: Object#clone returns self, you should implement a #dup if you want to support copying
<BlaXpirit> dyulax, ok, symbols are turned into unique numbers
<BlaXpirit> use Symbol#to_i , sounds perfect
<BlaXpirit> i thought this was something generic that can accept any object
<jhass> >> :foo.to_unsafe
<DeBot> jhass: Error in line 4: undefined method 'to_unsafe' for Symbol - http://carc.in/#/r/e6b
<trapped> jhass: but shouldn't it return a "deep copy" of the object? isn't there .itself already if one wants to have a "pointer copy" of the object?
<BlaXpirit> but i dunno, leaving out the possibility to use a number doesn't sound so good
<jhass> mmh, Symbol#to_unsafe could be fun actually :P
<trapped> dyulax: can't you use an enum
<dyulax> I am converting a Ruby gem into a Crystal :-) that's why I have this issue with Symbols... hehehe
<BlaXpirit> trapped, no, this is not a case for an enum
<dyulax> I want to keep the API as close as possible
<BlaXpirit> honestly i would've preferred just numbers
<trapped> that makes sense, dyulax
<dyulax> the original accepts any object, but now I will limit to Symbols and use to_i
<BlaXpirit> i can do whatever i want with numbers
<trapped> jhass: i have seen that page
<dyulax> thank you guys, sorry for asking stupid questions
<BlaXpirit> but with symbols i cannot dynamically make layers
<jhass> dyulax: no worries, you're welcome
<trapped> at this point i don't see what .clone is actually doing
<thor77> o.O there's a new api-page
<dyulax> hmmm...
<BlaXpirit> in ruby it's OK because you can make a symbol into a number
<BlaXpirit> uh vice versa
<BlaXpirit> if i want to name my layers, i make an enum or a constant
<trapped> i mean, i probably am using subclasses of Object
<jhass> trapped: Object#clone should probably be abstract too, yeah
<trapped> it should rather be automatically generated for each class
<trapped> i would've expected it to be somewhat like a memcpy of a struct
<trapped> whereas .dup would be user defined
<jhass> it's a bit tricky to do due to macro defs not inferring return type and having no "definition is final" point
<trapped> can't it be generated at the latter codegen pass instead of the macro expansion pass?
<trapped> i mean, i don't know how the crystal compiler actually works, but i would assume that when it starts spewing llvm ir it should already have inferred enough types
<jhass> problem is that you don't want a mindless deep copy
<BitPuffin> are builds of crystal provided?
<jhass> you don't want to just copy file descriptors and stuff like that
<BitPuffin> oh hmm
<jhass> BitPuffin: sure, it's self hosted, you'd have no way to compile crystal otherwise ;)
<BitPuffin> doesn't it work on windows?
<jhass> ?windows
<DeBot> Windows support is currently developed at https://github.com/xwanderer/crystal/tree/win32/win32
<BitPuffin> yeah I guess that's true :P
<BitPuffin> hmm
<BitPuffin> I don't have time to download llvm and compile that now, was hoping I could get a build and docs to toy with on the bus
<BitPuffin> I'll save it for another day :D
<jhass> well, get a VM?
<trapped> jhass: why not? isn't it considered to be unsafe?
<BitPuffin> well that's still too much setup for me to be able to toy with on the bus since I'm leaving now xD
<jhass> trapped: say you copy a file instance and call close on one, the other continues to think it's still open
<jhass> and that's just a simple example
<jhass> BitPuffin: mmh, one should always have at least a linux VM :P
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZL07
<crystal-gh> crystal/master 1a08879 Ary Borenszweig: Fixed #1406: Wrong error message when overload is not found on a method that's an implementation of an abstract method
<BitPuffin> jhass: true :P
<BitPuffin> anyway g2g see you guys some other time
BitPuffin has quit [Ping timeout: 246 seconds]
<travis-ci> manastech/crystal#1a08879 (master - Fixed #1406: Wrong error message when overload is not found on a method that's an implementation of an abstract method): The build passed. https://travis-ci.org/manastech/crystal/builds/79168748
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZLg4
<crystal-gh> crystal/master 705c951 Ary Borenszweig: Simpler code for previous commit
leafybasil has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
<ponga> jhass: what linux distro are you on?
<jhass> arch
<ponga> cool, i wish i knew how to manage arch
<sardaukar> has anyone tried to create a daemon in Crystal?
<sardaukar> is there code online for it?
<jhass> sardaukar: I'd strongly recommend to deploy a supervisor
<ponga> i feel dumb that i use elementary os
<jhass> self daemonization is meh
<sardaukar> why?
<sardaukar> I think this is proper for Ruby
<sardaukar> but for a language that can create binaries...?
<jhass> all the external references in that blog post address things like your database, webserver and whatever, anything really
<jhass> I'm looking forward to Gnome finally fully switching to full systemd user sessions so I can replace all the autostart madness with properly supervised processes
waterlink has joined #crystal-lang
<sardaukar> well, there's no way to do setsid() in Crystal anyway :/
<jhass> well you can just bind the C function
<jhass> I do that for setuid somewhere
<jhass> that's for when you want to contribute it, yeah
<ponga> jhass: this sounds dumb, but daemon is basically a background system process?
<jhass> ponga: yeah
<ponga> gud, i got it righ this time
<jhass> ponga: well nowadays it's a process that offers you some kind (that's intentionally vague) of service
<sardaukar> so based on the docs here http://pubs.opengroup.org/onlinepubs/009695399/functions/setsid.html it's basically fun setsid : PidT
<jhass> yeah
<sardaukar> and closing file descriptors?
<jhass> which ones?
<sardaukar> final step in daemonizing: "Close all open file descriptors that may be inherited from the parent process."
<jhass> ponga: dbus, postgresql, apache, postfix, syslog, cron, (g|k|light|x)dm and so on, all daemons
<ponga> ah hah
shadeslayer has quit [Ping timeout: 250 seconds]
<ponga> why is jhass so kind to me? I wonder
<ponga> ;p
<jhass> sardaukar: so I guess {STDIN, STDOUT, STDERR}.each &.close ?
<sardaukar> is there a way to get the open ones?
shadeslayer has joined #crystal-lang
<sardaukar> a select()?
<jhass> not aware of any
<jhass> I think we set CLOS_ON_EXEC nowadays anyway
<sardaukar> ok, gonna try this
<sardaukar> jhass: if I contributed a Daemon module to Crystal's stdlib, would it be rejected?
<jhass> tbh I'd argue against it
<jhass> but I'm not to decide ;)
<sardaukar> I see
<sardaukar> I find it appealing for ease of distribution and use
<sardaukar> until supervisors get a standard or something, configuring a process under them is a pain
<jhass> well, systemd kind of is getting a standard
<sardaukar> the flamewars over that will never subside :D I doubt a standard behind it will gain any traction
<sardaukar> and the definition DSL for systemd seems open for change a lot
<jhass> mmh, no it actually doesn't change much, didn't notice a single change in fact. Just additions ;)
<sardaukar> riiiight :D
<jhass> they take some care in having what they add cover everything it should cover
<jhass> and to arrive at some strong opinion on what it should cover, so changing it becomes less likely
<sardaukar> I'm a fan of systemd, but it's a tough one
<sardaukar> one of the reasons Linux thrives is because of its tinker-friendliness
<sardaukar> systemd heralds a new era of more standardized systems
<sardaukar> that some ppl are having a tough time accepting :/
<jhass> sure, it's doing things differently than what people got used to
<jhass> that'll always produce rejection, humans just work that way
<sardaukar> being from the same guy as PulseAudio doesn't help, either
<jhass> in its extremes that's where racism comes from
<ponga> well, getting Asian langs to work on Linux is still a pain in an arse
<ponga> ;(
<sardaukar> I can imagine
<ponga> sardaukar: my case, is that, I'm trilingual who want my OS to funtion both Japanese and Korean, trouble is the best input system for each is usually different package, so its hard to switch around
<ponga> Its a biggest reason i stick to OSX
<ponga> standardised multilingualism
<sardaukar> and I'm sure most open-source CJK fonts are not that good
<jhass> well, I'm German but I just keep my systems set to English everywhere except timezone and keyboard
<sardaukar> QWERTZ - so weird! :D
<jhass> the translations just make 70% of all error messages meaningless or confusing
<sardaukar> I'm Portuguese, same issue
<ponga> jhass: true, but im mostly talking about input system here
<sardaukar> but I like US keyboards - good for coding
<jhass> I meant to learn Neo2 but it slows me down too much so I always switch back :/
<ponga> good thing is that kor/jap keyboard layout is identical to US
<ponga> thank god, if otherwise, i'd have hung myself a long time ago
<sardaukar> that's good - PT is almost the same, but the ;: key is ç instead!
<sardaukar> a whole key for such a rare character!! :D
<ponga> as i always say, you euros and your roman alphabet clash
<ponga> lol
n0xff has joined #crystal-lang
dyulax has quit [Quit: This computer has gone to sleep]
dyulax has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #1407: Let loop yield the iteration count (master...loop_index) http://git.io/vZLS2
BlaXpirit has quit [Quit: Konversation]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZLFz
<crystal-gh> crystal/master f4119c4 Ary Borenszweig: Merge branch 'class-level-macros'
<travis-ci> manastech/crystal#f4119c4 (master - Merge branch 'class-level-macros'): The build passed. https://travis-ci.org/manastech/crystal/builds/79185878
kulelu88 has quit [Ping timeout: 260 seconds]
kulelu88 has joined #crystal-lang
blue_deref has quit [Quit: Taking myself out of hear.]
havenwood has joined #crystal-lang
waj has quit [Remote host closed the connection]
dyulax has quit [Ping timeout: 244 seconds]
sailorswift has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
fowlduck has joined #crystal-lang
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blue_deref has joined #crystal-lang
willl has joined #crystal-lang
waj has joined #crystal-lang
kyrylo has quit [Ping timeout: 256 seconds]