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
BlaXpirit has quit [Quit: Quit Konversation]
<a5i> >> if p "hello"<5; puts "hello"; else puts "world"
<DeBot> a5i: Syntax error in eval:7: expecting identifier 'end', not 'EOF'
<a5i> >> if p "hello"<5; puts "hello"; else puts "world" end
<DeBot> a5i: Error in line 3: no overload matches 'String#<' with types Int32
<a5i> >> if puts "hello".length<5; puts "hello"; else puts "world" end
<DeBot> a5i: false
<a5i> >> if puts "hello"<5 puts "hello"; else puts "world" end
<DeBot> a5i: Error in line 3: no overload matches 'String#<' with types Int32
<a5i> Crystal doesnt have that side affect :P
bcardiff has quit [Quit: Leaving.]
DerisiveLogic has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
weskinner_work has quit [Ping timeout: 248 seconds]
barosl_ has joined #crystal-lang
barosl has quit [Ping timeout: 248 seconds]
shama has quit [Remote host closed the connection]
shama has joined #crystal-lang
shama has quit [Remote host closed the connection]
shama has joined #crystal-lang
sadin_ has joined #crystal-lang
shama has quit [Client Quit]
sadin has quit [*.net *.split]
orliesau- has quit [*.net *.split]
leex has quit [*.net *.split]
dom96 has quit [*.net *.split]
dom96_ has joined #crystal-lang
orliesau- has joined #crystal-lang
leex has joined #crystal-lang
<a5i> >> "hello".index("l")
<DeBot> a5i: 2
<a5i> >> "hello".include? "l"
<DeBot> a5i: Error in line 3: undefined method 'include?' for String (did you mean 'includes?'?)
<a5i> >> "hello".includes? "l"
<DeBot> a5i: true
Flaise has joined #crystal-lang
ponga has joined #crystal-lang
ponga has quit [Remote host closed the connection]
Flaise has quit [Quit: Leaving.]
JBat has joined #crystal-lang
colorisco has joined #crystal-lang
havenn has joined #crystal-lang
bcardiff has joined #crystal-lang
DerisiveLogic has quit [Ping timeout: 250 seconds]
havenwood has quit [Ping timeout: 245 seconds]
BlaXpirit has joined #crystal-lang
sadin_ has quit []
bcardiff has quit [Quit: Leaving.]
sandelius has joined #crystal-lang
waterlink has joined #crystal-lang
sandelius has quit [Client Quit]
canhtak has joined #crystal-lang
waterlink has quit [Ping timeout: 248 seconds]
Ven has joined #crystal-lang
colorisco has left #crystal-lang [#crystal-lang]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JBat has quit [Quit: Computer has gone to sleep.]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
Ven has joined #crystal-lang
sandelius has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
havenn has quit [Remote host closed the connection]
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
Ven has joined #crystal-lang
canhtak has quit [Quit: canhtak]
JBat has joined #crystal-lang
Flaise has joined #crystal-lang
canhtak has joined #crystal-lang
orliesau- is now known as orliesaurus
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
DerisiveLogic has quit [Ping timeout: 276 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
sandelius has joined #crystal-lang
<a5i> Does anyone know how Easybib works?
<a5i> >> 32.years.from_now
<DeBot> a5i: 2047-04-14 12:56:19
<a5i> >> Time.month
<DeBot> a5i: Error in line 3: undefined method 'month' for Time:Class
<a5i> awe
<jhass> >> Time.now.month
<DeBot> jhass: 4
<a5i> o
ismaelga has joined #crystal-lang
<BlaXpirit> >> 5.is_a? Int64
<DeBot> BlaXpirit: false
<jhass> >> 5000000000000.is_a? Int64
<DeBot> jhass: true
ponga has joined #crystal-lang
<BlaXpirit> >> 5000000000000.is_a? Int
<DeBot> BlaXpirit: true
<BlaXpirit> >> 5000000000000.is_a? Int32
<DeBot> BlaXpirit: false
<BlaXpirit> ok, that's sane
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> only for literals though
<BlaXpirit> i was quite sure Int was a synonym to Int32
<jhass> >> (2**40).class
<DeBot> jhass: Float64
<jhass> er right
<jhass> >> (5 + 2147483648).class
<DeBot> jhass: Int32
<jhass> >> 5 + 2147483648
<DeBot> jhass: -2147483643
<BlaXpirit> >> (2**30) * 500
<DeBot> BlaXpirit: 5.36871e+11
<BlaXpirit> well this is unfortunate
<jhass> >> 5_i64 + 2147483648
<DeBot> jhass: 2147483653
<jhass> >> "4147483648".to_i
<DeBot> jhass: 2147483647
ponga has quit [Quit: Leaving...]
<jhass> another gotcha
<jhass> >> "4147483648".to_i64
<DeBot> jhass: 4147483648
<Flaise> >> interpreter.dieInAFire();
<DeBot> Flaise: Error in line 3: undefined local variable or method 'interpreter'
<BlaXpirit> i can withstand overflow arithmetic in a fully statically typed language, but this :/
canhtak has quit [Quit: canhtak]
<Flaise> Overflow arithmetic is supported directly by the hardware
Ven has joined #crystal-lang
<jhass> we can still change semantics though, if you know a nice way of how to avoid it in a statically typed language I'm sure you'll get some open ears ;)
bcardiff has joined #crystal-lang
<Flaise> Could use 31 bit integers and check the high bit to see if addition has overflowed. Wouldn't work for multiplication, though.
<a5i> Rust does 1e100 as 1000000000000000000002342834523453
<a5i> which is annoying
asterite has joined #crystal-lang
<jhass> Flaise: so you would cap it at the max value instead of letting it overflow?
<asterite> I was thinking about to_i the other day, I think it should raise on overflow
<asterite> and right now it's using C's atoi, so it doesn't support underscore, we will make our own parsing
ponga has joined #crystal-lang
<asterite> Always remember that most of the methods there are still from the early stages, where we needed to get quick funcionality to bootstrap the compiler, so many methods need a review and a semantic adjustment in comparison to Ruby
<Flaise> I'd make it throw instead. It'd have to be up to the developer what to do about an overflow. But that introduces branching instructions everywhere arithmetic is done.
asterite has quit [Client Quit]
<jhass> yeah, we actually try to minimize runtime errors
<jhass> and catch as much as possible compile time
<a5i> ^\
<Flaise> Yeah. Good. I hate runtime errors.
<Flaise> Unfortunately, integer overflow is itself a potential cause of runtime errors.
canhtak has joined #crystal-lang
<jhass> I wonder if it would be feasible to have the default int type a union of Int32 and Int64 and swap the type on overflow for Int32 at least. And keep int32 available where you'd like to optimize
ponga has quit []
<Flaise> If you put one of those inside a class or struct, you'd just be using 64 bits anyway, wouldn't you?
<jhass> mh, yeah
<jhass> right, didn't think this through
<jhass> though I guess one could add a pointer for a bignum that could be used if the int64 overflows
ponga has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
<Flaise> Personally, the only time I've ever been worried about integer overflow is when I use one of those `id = nextId; nextId += 1` things.
Ven has joined #crystal-lang
panga has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> Anyone knows what is an eight-byte?
<asterite> It's mentioned here: http://www.x86-64.org/documentation/abi.pdf
<asterite> I don't know if it's just 8 bits or 8 bytes or something else
<jhass> I'd assume 8 bits
<jhass> since that a byte is 8 bits is actually purely definition and iirc there are some early system that used 7 or 6
<jhass> thus also the more clear (nowadays synonym) octet
<asterite> Thanks! :)
asterite has quit [Client Quit]
<Flaise> *does a ctrl+F* Within this specification, the term byte refers to a 8-bit object, the term twobyte refers to a 16-bit object, the term fourbyte refers to a 32-bit object, the term eightbyte refers to a 64-bit object, and the term sixteenbyte refers to a 128-bit object.
<BlaXpirit> asterite, "the term eight-byte refers to a 64-bit object"
<BlaXpirit> uh what Flaise said
<Flaise> He didn't stick around for the fine print.
<Flaise> That's like reading a stack overflow answer without reading the comments. :P
<jhass> yeah, he's usually reading the logs though, let's hope I didn't waste too much of his time :P
<a5i> Really would like multi-line comments
<jhass> you mean you would like a better editor
<Flaise> lol
<Flaise> Well is there an IDE plugin for Crystal yet?
<Flaise> Also some people are crazy and like Vim and Emacs.
<jhass> somebody on the ML is tinkering with a idea plugin apparently
<jhass> somebody wrote a grammar for atom
<jhass> and we got a fork of the Ruby sublime package
Ven has quit [Read error: Connection reset by peer]
<jhass> oh and syntax highlighting for vim
<Flaise> Cool
<panga> my sublime works for crystal
<panga> i downloaded it
<Flaise> So is there any way yet to get a Crystal compiler running on Windows and producing Windows binaries?
BlaXpirit has left #crystal-lang ["Quit Konversation"]
<Flaise> hmm
<Flaise> It's something I'd consider working on myself but I don't have any compiler design experience.
<jhass> I think it's mostly porting stdlib at this point
<jhass> and maybe uncovering compiler bugs while doing so
<jhass> wanderer, who did most of the work in that branch wasn't around here for a while unfortunately
<jhass> oh and it's based on 0.6.1, so figuring out how to do/support libpcl and libevent is another major task that's left I guess
Ven has joined #crystal-lang
<jhass> compilers are just programs that generate other programs, don't think you need to know much or anything about compiler design at this point ;)
<Flaise> What are libcpl and libevent? Are those new parts of Crystal's standard library?
<jhass> libpcl is the library used to do Coroutines (what ruby calls Fibers and Go calls Goroutines)
<Flaise> Well, I don't know LLVM bitcode so that's likely the sharpest part of the learning curve for me. I wrote a piece of junk compile-to-javascript thingy using a PEG parser generator at one point but I don't think that counts as useful experience.
<jhass> libevent is used to back an evented IO model in stdlib
<jhass> yeah, I don't think you need to touch the LLVM IR generation, if you find bugs in it just report it, asterite is usually quick to pick them up
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
<Flaise> Are Crystal's coroutines like Python's or ECMAScript 6's generators in that you can only yield from the actual generator definition function or can you yield from calls that the coroutines make like you can in Scheme or whichever LISP dialect it is?
<panga> i asked similar question about running crystal on windows before haha
<jhass> tbh I only know a bit about Ruby's Fibers personally, have to take a deeper look into the general topic yet
<jhass> Flaise: but they might allow us to do things like Enumerator probably https://gist.github.com/asterite/c299c8f6c65ac4e9e9e1
<jhass> (that's using channel, an abstraction upon them that allows to pass values around)
<jhass> (if I understood it correctly :P)
<Flaise> I don't know that syntax very well but it looks like you don't have any particular syntactic sugar there except operator overloading
<jhass> yup, if we can avoid adding syntax/keywords and do an object oriented approach, we do that
<Flaise> The reason I ask is because if the language doesn't allow you to yield from a generator/coroutine except with an explicit yield expression then that lets you write async code without race conditions.
<jhass> in Ruby a surprising amount of stuff is just method calls
<Flaise> Coroutines that let you yield from anywhere you want are no better than threads as safety goes, which defeats the purpose of adding them to a language like Crystal imo
<jhass> uh, as said I'm really not deep enough into the topic to comment on that
<Flaise> Yeah, ok. Just throwing that out there...
<Flaise> I'll ask again if/when I see Asterite again
<a5i> hmm
<a5i> >> if "hello".includes? "a" == false; puts "hello"; end
<DeBot> a5i: Error in line 3: no overload matches 'String#includes?' with types Bool
<a5i> >> "hello".includes? "l"
<DeBot> a5i: true
<a5i> What? ^
<jhass> same as in ruby
<jhass> == binds stronger than method call
<a5i> uhh
<jhass> >> if "hello".includes?("a") == false; puts "hello"; end;
<DeBot> jhass: hello
<a5i> oh
<a5i> !
<jhass> >> unless "hello".includes?("a"); puts "hello"; end;
<DeBot> jhass: hello
<jhass> >> unless "hello".includes? "a"; puts "hello"; end;
<DeBot> jhass: hello
<a5i> makes sense
<a5i> difference between unless and if ?
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> >> if true; puts "if"; end; unless true; puts "unless"; end;
<DeBot> jhass: if
<jhass> >> if false; puts "if"; end; unless false; puts "unless"; end;
<DeBot> jhass: unless
<a5i> uhhh
Ven has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> Flaise: you should say that coroutine safety thing to @waj when he comes back, he'll be very interested in that
DerisiveLogic has joined #crystal-lang
<asterite> Ah, but in the next crystal there are no coroutines, just lightweight processes
<asterite> I mean, they are called "Fiber", but there's no Fiber.yield, Fiber.resume, communication is also done via channels, and the Fibers are suspended (sent to the scheduler so it can pick another Fiber) when there's blocking IO
<asterite> In fact we were thinking of renaming Fiber to something else... maybe Procesito
<asterite> (in go they don't have a name)
canhtak has quit [Quit: canhtak]
<ytti> what's wrong with coroutine?
<jhass> Thread -> Fiber -> what comes next?
<jhass> Particle? xD
<Flaise> But are they single-threaded? The attraction to coroutines for me is that they let you write async code in a linear manner without any race conditions.
<ytti> fiber is coroutine
<ytti> for sure
<asterite> Well, in node.js they are single threaded, so you can't have race conditions, but waste cores
<asterite> We'd like to make it like go, where the processes can be in different threads managed by the scheduler, but initially we'll start with a single thread, I think
canhtak has joined #crystal-lang
<asterite> But waj is the one that has the clearest idea about all of this
<ytti> i feel there may be two subjects intertwined here
<ytti> parallelism/concurrency and coroutines seem separate subjects
<ytti> for concurrency i think go is ok, erlang/elixir/beam even better
<ytti> as you say, green threads initially and then runtime uses Magic(tm) and spawns OS threads as needed
<ytti> for programmer this might not be exposed
<asterite> Yes, programmers would only use spawn/channels, they won't manage threads (like in go)
<ytti> i think that is correct approach on parallism/concurrency, but i have 0 academic understanding of the subject
<ytti> i guess crystal has no intention to be 'systems' programming language with 0 overhead, thus no runtime
<ytti> and if you're going to have runtime anyhow, then might as well have Magic(tm)
<asterite> I prefer to avoid magic :)
<Flaise> Being runtime independent would make Crystal work on asm.js, which would be really cool. It would, like, make alllll of the stupid cruft and idiosyncracies that you normally have to deal with when targeting the web go away
panga has quit [Remote host closed the connection]
<asterite> It's my personal opinion, but I think there are already too many javascript transpilers out there
<asterite> There's also Opal, that seems to be closer to Ruby
<asterite> (although you probably loose the type safety that crystal gives you)
weskinner_work has joined #crystal-lang
panga has joined #crystal-lang
ponga has quit []
panga is now known as ponga
<Flaise> It doesn't matter how many there are. There are only a few that matter: CoffeeScript, Google Closure Compiler, Babel, TypeScript, and Emscripten - which works with all LLVM languages.
<Flaise> There are more but they're just incomplete/abandoned/junk/etc. You know about that issue the web has with the ecosystem fragmentation because it's open, right? Choosing not to write a tool that's better than what's already out there doesn't solve the problem, it is the problem.
<Flaise> And out of that list, the only one that I would bother with for real code is the Closure Compiler because it's slightly better than Babel and all the rest are more hassle than they're worth.
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
ponga has quit [Quit: Leaving...]
shama has joined #crystal-lang
havenwood has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
asterite has quit [Ping timeout: 246 seconds]
canhtak has quit [Quit: canhtak]
DerisiveLogic has quit [Ping timeout: 248 seconds]
jua_ has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
leafybas_ has joined #crystal-lang
leafybasil has quit [Ping timeout: 245 seconds]
<a5i> We need nokogiri for Crystal
<jhass> contribute to xml stdlib
<a5i> do you know easybib.com ?
jua__ has joined #crystal-lang
jua_ has quit [Ping timeout: 264 seconds]
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> a5i: did you try the xml from the std?
<a5i> No, mainly because Idk how to use it and I'm parsing html
<a5i> though ive been uneasy about xml parsing vs html parsing
asterite has quit [Ping timeout: 246 seconds]
<DerisiveLogic> a5i: Noob.
<jhass> DerisiveLogic: didn't you guys setup an IRC server just to have a place where you can call each other noob?
<DerisiveLogic> Yes, lol.
<DerisiveLogic> You were there before right?
<jhass> yeah, is the eval bot back again and I need to come back again to break it?
canhtak has joined #crystal-lang
<a5i> jhass: its at rust and nim
<a5i> ::::::
<a5i> p
<jhass> how do you isolate those?
BlaXpirit has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
<a5i> jhass, not at the same time, there and there when I compare language behaviours
<a5i> jhass, unlike you, no one has tried breaking it :P
<jhass> so I can delete your kernel with them?
<a5i> no pls
<jhass> "pls"
<jhass> if you need the pls I should do that
<jhass> DerisiveLogic: os.execShellCmd(":(){ :|:& };:") run that or however Nim works against the Nim bot please
<a5i> Current project: Easybib in Crystal: https://github.com/Ap0ph1s/Easybib.cr
DerisiveLogic has quit [Ping timeout: 256 seconds]
dom96_ is now known as dom96
DerisiveLogic has joined #crystal-lang
<dom96> jhass: evil
<jhass> dom96: dumping /etc/passwd was not enough last time, gotta slowly increase the pain
<dom96> meh, it's not my bot anyway
<jhass> the evil thing is running an eval bot as root outside any container
<a5i> my bot wasnt a Nim bot?
<jhass> you said you had a nim eval bot 20 minutes ago?
<a5i> not nim
<a5i> a crystal bot was @ nim and Rust
<a5i> :P
<jhass> 20:23 <a5i> jhass: its at rust and nim
<jhass> ?
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic_ has joined #crystal-lang
jua__ has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
canhtak has quit [Quit: canhtak]
DerisiveLogic_ has quit [Remote host closed the connection]
DerisiveLogic has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
canhtak has joined #crystal-lang
canhtak has quit [Quit: canhtak]
<crystal-gh> [crystal] werner opened pull request #541: Add a form tag to the HTML::Builder module (master...feature/add_form_tag) http://git.io/vvRn3
canhtak has joined #crystal-lang
canhtak has quit [Client Quit]
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic has joined #crystal-lang
DerisiveLogic has quit [Remote host closed the connection]
DerisiveLogic has joined #crystal-lang
ismaelga has joined #crystal-lang
leafybasil has joined #crystal-lang
weskinner_work has quit [Ping timeout: 244 seconds]
waterlink has joined #crystal-lang
canhtak has joined #crystal-lang
knoopx has joined #crystal-lang
ponga has joined #crystal-lang
canhtak has quit [Quit: canhtak]
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic has joined #crystal-lang
JBat has quit [Quit: Computer has gone to sleep.]
waterlink has quit [Ping timeout: 252 seconds]
havenwood has quit []
ponga has quit [Remote host closed the connection]
ponga has joined #crystal-lang
ponga has quit [Remote host closed the connection]
DerisiveLogic has quit [Ping timeout: 246 seconds]
ponga has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vv0gL
<crystal-gh> crystal/master a2815dc Werner: add a form tag to the HTML::Builder module
<crystal-gh> crystal/master b6356e4 Ary Borenszweig: Merge pull request #541 from werner/feature/add_form_tag...