jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.4 | Fund Crystals development: http://to.ly/TtGw | 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
NeverDie has joined #crystal-lang
flaviu has quit [Ping timeout: 252 seconds]
dwahl has quit [Ping timeout: 244 seconds]
flaviu has joined #crystal-lang
flaviu has quit [Read error: Connection reset by peer]
flaviu has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
medcat has joined #crystal-lang
havenwood has joined #crystal-lang
havenwood has quit [Ping timeout: 252 seconds]
havenwood has joined #crystal-lang
medcat has quit [Remote host closed the connection]
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #crystal-lang
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
sardaukar has quit [Ping timeout: 256 seconds]
sardaukar_ has joined #crystal-lang
sardaukar_ has quit [Ping timeout: 256 seconds]
sardaukar has joined #crystal-lang
sardaukar has quit [Ping timeout: 256 seconds]
sardaukar has joined #crystal-lang
havenwood has joined #crystal-lang
ponga has joined #crystal-lang
sergey-kucher has joined #crystal-lang
sergey_kucher has joined #crystal-lang
sergey-kucher has quit [Quit: Leaving]
havenwood has quit [Ping timeout: 265 seconds]
BlaXpirit has joined #crystal-lang
hangyas has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
ERBSE has joined #crystal-lang
Kilo`byte has quit [Ping timeout: 264 seconds]
<hangyas> hi all, is it possible to pass a hash to a method without the round parentheses?
<hangyas> I mean something like `method {foo => bar}`
Kilo`byte has joined #crystal-lang
<BlaXpirit> hangyas, i dont see a way
<hangyas> :( thanks anyway
unshadow has joined #crystal-lang
ERBSE has quit [Quit: Leaving.]
sardaukar has quit [Ping timeout: 256 seconds]
<jhass> hangyas: doesn't work in ruby either, it's just a bit too ambiguous to passing a block
_whitelogger__ has joined #crystal-lang
asterite_ has joined #crystal-lang
hangyas has quit [*.net *.split]
emmanueloga has quit [*.net *.split]
AckZ has quit [*.net *.split]
DeBot has quit [*.net *.split]
n1ftyn8_ has quit [*.net *.split]
asterite has quit [*.net *.split]
_whitelogger_ has quit [*.net *.split]
AckZ_ is now known as AckZ
<jhass> yeah, you can leave off the curly braces
<jhass> and thus also foo bar => baz
n1ftyn8__ is now known as n1ftyn8_
unshadow has quit [Quit: leaving]
emmanueloga has joined #crystal-lang
leafybasil has joined #crystal-lang
DeBot has joined #crystal-lang
havenwood has joined #crystal-lang
<thor77> is OpenSSL::SSL::Socket broken? http://carc.in/#/r/8bo
<jhass> uh, maybe?
<thor77> :(
<jhass> thor77: actually your require is just wrong http://carc.in/#/r/8bp
<thor77> uh...
<thor77> ty
<thor77> http://carc.in/#/r/8br that should work, right?
<thor77> it gives me this weird exception: http://pastie.org/private/lywjoxd5gr9une5luwkrhg
<jhass> thor77: you hand it Channel(String), not an instance of it
<jhass> that's what the :Class is saying
<thor77> aaaaaaaaahhhhh -.-
<thor77> thanks
<jhass> yw
hangyas has joined #crystal-lang
<hangyas> jhass: Do you mean like this: http://carc.in/#/r/8by ?
<jhass> hangyas: that works in Ruby, yes
<jhass> Ary and waj have deliberately chosen to not allow it, I guess to encourage actual keyword args over option hashes
<hangyas> I see
<hangyas> at least it works with arrays
<hangyas> oh and hash works too if it's not the first arg
ponga has left #crystal-lang [#crystal-lang]
blue_deref has joined #crystal-lang
HoloIRCUser has joined #crystal-lang
HoloIRCUser is now known as witdex
witdex has quit [Remote host closed the connection]
<jhass> ah yeah, basically the block has precedence, so if it could look like a block, it's taken as such and then parsing it fails
<flaviu> @catb!64
<flaviu> oh, fuck me
NeverDie has joined #crystal-lang
hangyas has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<Kilo`byte> just curious, how secure is a crystal compiled binary (assuming the code it was compiled from contains no flaws) against local attacks?
<Kilo`byte> should i use crystal for setuid stuff or should i wait with that?
<jhass> shouldn't be any different that C
<Kilo`byte> kk
<jhass> the attack surface is a little higher since most Crystal binaries end up linking gc, pcl, gmp & pcre
<Kilo`byte> (probably with the exception that c is slighly easier to screw up)
<jhass> and libevent
<jhass> oh and libunwind
<Kilo`byte> well, all those libraries are only writable by root
<Kilo`byte> and if an attacker can write a file as root you have completely different issues
<jhass> yeah, and if you don't feed user input to them it's unlikely for flaws in them being exploited through your binary
<Kilo`byte> pcre is probably the only one i'd feed user-supplied data :P
<jhass> well, libevent too
<jhass> gmp isn't too unlikely either actually
<Kilo`byte> whats gmp?
<Kilo`byte> well, what i am planning would probably not run as root either but as a specific user
<jhass> BigInteger
<Kilo`byte> oh okay
<Kilo`byte> well, what i plan just needs to access a database that should not be fully accessible to any user :P
<jhass> but yeah, I think it's okay, I actually have Crystal root setuid wrappers for carc.in
<jhass> though rather minimal ones
<Kilo`byte> well, not that many users can access this box anyways, but i prefer professional solutions :P
<flaviu> keep in mind that the crystal compiler is also additional complexity here.
<Kilo`byte> that is my main concern :P
<Kilo`byte> i mean, i have discovered compiler bugs before :P
<jhass> the exploitable ones I'd expect in a category of producing segfaulting binaries
<jhass> which I think is none known left atm
<flaviu> has anyone run the compiler test suite with fsanitize flags?
<jhass> doubt it
<Kilo`byte> btw, completely unrelated, i have talked to someone else about crystal and he was kinda disappointed that it forces a garbage collector on you. which leaved the question: how likely is it that crystal will get a manual memory mode which makes you need to manage memory manually?
<Kilo`byte> i assume not very likely, but its worth thinking about it
<jhass> yeah, not very likely
<Kilo`byte> as the entire standard api would have to be able to cope with that
<jhass> there are a few ways to obtain memory that's managed by the GC though
<jhass> basically calling through to LibC malloc/mmap
<jhass> (and releasing it with LibC free again)
<Kilo`byte> well, i think the point is that for many things the overhead of a garbage collector is not what everyone was
<jhass> er, that's not managed
<jhass> like?
<flaviu> Kilo`byte: you can always use malloc and free and stack allocation.
<flaviu> and memory pools
<Kilo`byte> its not my complaint :P
<Kilo`byte> tbh, its not like there are many uses of manually managing memory imo
<flaviu> All I can really think of is frequently allocated objects in games and UI stuff.
<flaviu> but just put those on the stack.
<jhass> yeah
<jhass> for example with C++ Bjarne claims that if there's a new or delete there's probably a bug
<Kilo`byte> tbh, if you really need to get that low-level, crystal is probably not the right language for you :P
<Kilo`byte> now what does make me in fact curious: how does a library made with crystal work?
<jhass> you can also still just do those parts as a C or whatever library that you statically link in
<jhass> we still lack good interfaces for that
<Kilo`byte> are they compiled and then linked or are they included by source
<jhass> ah, that's what you mean
<jhass> for crystal libraries we'll go with by source distribution
<jhass> since the mangling is not deterministic afaik and also type tags are random
<jhass> so basically like ruby
<Kilo`byte> hmm... well, if you ever want the ability to load libraries at runtime (libdl style) that won't work anymore
<jhass> yeah
<Kilo`byte> i mean, in ruby you can quite easily do that by just load()ing the file
<jhass> the shared library case is still an open question
<Kilo`byte> but that doesn't work in a compiled language for obvious reasons
<jhass> top level fun's are unmangled, so you can do stuff like https://gist.github.com/k2b6s9j/3bd3aadd71db206e828f
<jhass> but as said, it's not pretty yet
<flaviu> Can't you use the compiler as a library?
<jhass> and afaik asterite_ & waj's standpoint is that doing shared libs with Crystal makes no sense due to GC
<Kilo`byte> flaviu: that sounds horribly hacky and seems like a lot of overhead
<jhass> flaviu: you can use it as a library to produce new executables, not to modify the currently running one
<Kilo`byte> so probably the best to do a plugin system would be using a named pipe or similar for communications
<Kilo`byte> or a binary thats launched by the core with them communicating over stdin/out
<Kilo`byte> but for that to be comfortable one would need something like marshal
<Kilo`byte> we'll see
asterite_ is now known as asterite
<Kilo`byte> only thing you could possibly do would be to compile libraries to some bytecode and then compile the bytecode to native code at load time with a special interface to do stuff like gc initialization
<Kilo`byte> idk how doable that is though :P
<Kilo`byte> (it'd also make the code depend on a big part of the compiler)
<jhass> well, I guess you could have calls or better yet classes and modules tagged with "extract to foo.so"
<jhass> and then some language level if foo.so_loaded? and stubs that raise if it isn't
<jhass> but it's really not worth it at this point I'd say
blue_deref has quit [Quit: bbn]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
Kilo`byte has quit [Ping timeout: 265 seconds]
wonderbreadz has quit [Ping timeout: 264 seconds]
wonderbreadz has joined #crystal-lang
Kilo`byte has joined #crystal-lang
<thor77> uhm. i don't think i understood the way "spawn" works... http://pastie.org/private/mtr29qchzbsbcblzis1guw http://pastie.org/private/9x7q2dvaucjrmdv1pxnsbq whats about my second "spawn"-call why doesn't it get executed?
<thor77> relevant parts of CrystalIRC::Connection http://pastie.org/private/mtr29qchzbsbcblzis1guw#54-63
<jhass> thor77: try using a channel for @queue
<thor77> jhass: it works \o/ thanks :)
<thor77> can you give me some feedback on the general structure of the code?
<jhass> I tend to order methods with invoked methods below invoking methods
<wmoxam> Are there any existing BDB bindings?
<wmoxam> :p
sergey_kucher has quit [Remote host closed the connection]
BlaXpirit has quit [Quit: Konversation]
<thor77> >> [1, 2, 3, 4][1, -1]
<DeBot> thor77: ArgumentError: negative count: -1 - more at http://carc.in/#/r/8c9
<jhass> >> [1, 2, 3, 4][1..-1]
<DeBot> jhass: # => [2, 3, 4] - http://carc.in/#/r/8ca
<jhass> >> [1, 2, 3, 4].drop(1)
<DeBot> jhass: Error in line 4: undefined method 'drop' for Array(Int32) - http://carc.in/#/r/8cb
<jhass> :(
<jhass> >> [1, 2, 3, 4].last(3)
<DeBot> jhass: Error in line 4: wrong number of arguments for 'Array(Int32)#last' (1 for 0) - http://carc.in/#/r/8cc
<jhass> :/
<thor77> woa..
* thor77 has a lot left to learn
<thor77> maybe i should read some ruby-books
<thor77> i'm always trying to use python-methods and python-ways to solve problems...
<jhass> :P
<jhass> >> [1, 2, 3, 4].each.drop(1)
<DeBot> jhass: Error in line 4: undefined method 'drop' for Array(T)::ItemIterator(Int32) - http://carc.in/#/r/8cd
<thor77> if i start trying ruby-methods/ways its at least not THAT far away ;D
<jhass> heh, it's not to far away
<jhass> >> [1, 2, 3, 4][1, 3]
<DeBot> jhass: # => [2, 3, 4] - http://carc.in/#/r/8ce
<thor77> ^ i want to do that dynamically
<thor77> in python it would be [1, 2, 3, 4][1:]
<jhass> yeah, see the second variant
<thor77> yeah, thanks for the variants
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
blue_deref has joined #crystal-lang
ozra has joined #crystal-lang
blue_deref has quit [Quit: bbn]