ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.22.0 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
zipR4ND has quit [Read error: Connection reset by peer]
zipR4ND has joined #crystal-lang
Aytan72 has joined #crystal-lang
bjz has joined #crystal-lang
Aytan72 has quit []
kubaxvx__ has quit [Remote host closed the connection]
nickc2 has quit [Read error: Connection reset by peer]
Aytan72 has joined #crystal-lang
zipR4ND has quit [Ping timeout: 260 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
bjz has joined #crystal-lang
Aytan72 has quit []
<FromGitter> <schoening> What are "Free variables"
<FromGitter> <schoening> nvm found it in the docs
Qchmqs has joined #crystal-lang
_whitelogger has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
Qchmqs has quit [Remote host closed the connection]
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
Qchmqs__ has joined #crystal-lang
Qchmqs__ is now known as Qchmqs
onionhammer has quit [Ping timeout: 240 seconds]
Qchmqs has quit [Remote host closed the connection]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
ben has joined #crystal-lang
Qchmqs__ has joined #crystal-lang
ChickeNES has quit [Ping timeout: 246 seconds]
<FromGitter> <bew> Whats the best way to pass an `Array(String)` to a C fun accepting `LibC::Char**` ?
<oprypin> bew, `that.map(&.to_unsafe)`
<FromGitter> <bew> nice, and the other way ? (from C to Cr)
<oprypin> well first you gotta know the size, right?
<FromGitter> <bew> yeah it's argv-style
<oprypin> `that.to_slice(size).map{ |p| String.new(p) }`
<oprypin> except to_slice isnt a thing, see immplementation here https://github.com/crystal-lang/crystal/pull/4327
<oprypin> nevermind, it is a thing for a pointer, so myexample should wok
<FromGitter> <bew> interesting, now as `that` is a null-terminated vector of string, what would be the fastest way to determine the size?
<FromGitter> <bew> I would think using a while in C, but there's maybe a crystal-way of doing this kind of things
<oprypin> bew, you said it's argv style so size is separate
<oprypin> null terminated vector is silly
<FromGitter> <bew> ah, I meant it's null terminated
<oprypin> that's not normal for sure
zipR4ND has joined #crystal-lang
<oprypin> what are you working with anyway?
<FromGitter> <bew> see return value: `unibi_get_aliases` https://github.com/mauke/unibilium/blob/master/doc/unibi_get_aliases.pod
<oprypin> mkay
<oprypin> i think that calls for an entirely different approach
<FromGitter> <bew> I also think I'll need to store the pointer I give to `unibi_set_aliases` to avoid GC collecting..
<oprypin> you just make an empty array, until pointer.null? arr << String.new(pointer); pointer += 1
<oprypin> bew, you're right about that
<oprypin> better store the Array which is the result of `.map(&.to_unsafe)`
<FromGitter> <bew> yes for sure
<FromGitter> <bew> thanks!
<FromGitter> <bew> @oprypin works well ;) ty
splitty__ has joined #crystal-lang
splitty___ has quit [Ping timeout: 240 seconds]
jeromegn has quit [Remote host closed the connection]
poikon has quit [Remote host closed the connection]
Qchmqs__ is now known as Qchmqs
poikon has joined #crystal-lang
jeromegn has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
yogg-saron has joined #crystal-lang
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Raimondi has quit [Ping timeout: 268 seconds]
<FromGitter> <MatthewBennington> Can someone tell my why this code (https://gist.github.com/MatthewBennington/d2bb2003e7785d13b4fa14bfb30d12b5) gives me this error? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59060222587a245e24628707]
<Papierkorb> MatthewBennington @@slot_counter is Int32.
<FromGitter> <MatthewBennington> Oh I see it
<FromGitter> <pta2002> the color enum is giving you Int32s, not Int16s like you're requesting
<Papierkorb> `1_16` is `116`
<Papierkorb> write `1u16` instead
<FromGitter> <MatthewBennington> I don't think it's an issue with the color enum though
<FromGitter> <MatthewBennington> Yeah `1_16` -> `1_i16` fixed it
<Papierkorb> apart from that, convention-wise the class should be called `ColorPair` (no underscore there), and the enum constants are written in camel-case
<FromGitter> <MatthewBennington> In this case I'm binding a c lib, is that still true?
<Papierkorb> You're writing Crystal code, that it binds to a c lib isn't important to the user of your class
<FromGitter> <MatthewBennington> Thanks
zipR4ND has quit [Ping timeout: 246 seconds]
<FromGitter> <KCreate> Does anyone know if `Hash#keys` returns the keys in the order they were added?
<FromGitter> <pta2002> @KCreate seems like it does
<FromGitter> <pta2002> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=590607366aea30763d58ae90]
<FromGitter> <KCreate> Is this guaranteed or could this just be a coincidence?
<FromGitter> <pta2002> I wouldn't rely on it, but I'm not sure
<FromGitter> <pta2002> `{"a" => "A", "b" => "B", "d" => "B", "c" => "C"} ` is what it returns btw
<Papierkorb> KCreate, you can rely on it, Hash retains insertion-order
<Papierkorb> It's a feature
<FromGitter> <KCreate> Alright, thanks!
Qchmqs has quit [Ping timeout: 258 seconds]
onionhammer has joined #crystal-lang
Raimondi has joined #crystal-lang
Raimondi has quit [Client Quit]
Raimondi has joined #crystal-lang
Shad has joined #crystal-lang
p0p0pr37 has quit [Remote host closed the connection]
p0p0pr37 has joined #crystal-lang
<FromGitter> <MatthewBennington> Are there are things which are supposed to be snake_case, other than methods?
<FromGitter> <sdogruyol> variables
<FromGitter> <MatthewBennington> Thanks
zipR4ND has joined #crystal-lang
<FromGitter> <thbar> @Sija thanks for the link to https://github.com/Sija/any_hash.cr !
Raimondi has quit [Write error: Broken pipe]
Raimondi has joined #crystal-lang
Shad has quit [Quit: Page closed]
early has quit [Quit: Leaving]
early has joined #crystal-lang
_whitelogger has joined #crystal-lang
Dreamer3 has joined #crystal-lang
tzekid has joined #crystal-lang
bjz has joined #crystal-lang
marius has joined #crystal-lang
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
zacts has quit [Quit: WeeChat 1.7.1]
tzekid has quit [Quit: tzekid]
<FromGitter> <bew> It's just me or the core team went on holiday? :D
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
<FromGitter> <elthariel> Salut @thbar :)
<FromGitter> <fridgerator> its been quiet lately
<oprypin> AAAAAAAAAAAAAAAAAAAAAAA
<FromGitter> <bew> BBBBBB?
<oprypin> no, that makes almost no sound
<oprypin> could try EEEEEEE
<FromGitter> <MatthewBennington> No, it's the sound a bee makes.
<FromGitter> <bew> u right, or IIIIII!
<FromGitter> <MatthewBennington> (I'm sorry)
<FromGitter> <bew> ^^
<FromGitter> <KCreate> Does anyone know if crystal includes a typeid into value types?
<FromGitter> <bew> yep
<oprypin> wait.. why are you saying that? I think it doesn't
<oprypin> it may include that in union value types
<FromGitter> <KCreate> I think it does in reference types, unions, abstract structs...
<FromGitter> <bew> u sure there is no type id in all types (instances or not)?
<FromGitter> <KCreate> nah that would be wasteful
<FromGitter> <KCreate> If the compiler knows that an instance variable is always Int32, it will encode it as Int32
<FromGitter> <bew> hmm, maybe only for class/struct/union then
<RX14> not for struct
<FromGitter> <bew> not in structsapparently
<RX14> class maybe
<RX14> union always
<FromGitter> <bew> yes for classes: https://crystal-lang.org/2015/03/04/internals.html
<RX14> i'm not sure about class but i'm like
<RX14> 90% sure they always have type IDs
<FromGitter> <KCreate> classes always have the type id
<FromGitter> <KCreate> Even if there are now subclasses
<FromGitter> <KCreate> There's an example in the docs which shows that
<FromGitter> <KCreate> (In the docs about instance_sizeof)
dannyAAM has quit [Ping timeout: 260 seconds]
dannyAAM has joined #crystal-lang
oz has quit [Ping timeout: 258 seconds]
oz has joined #crystal-lang
jokke has quit [Quit: WeeChat 1.7]
jokke has joined #crystal-lang
Gacrux has joined #crystal-lang
txdv has quit [Ping timeout: 268 seconds]
Gacrux has left #crystal-lang ["Leaving"]
bjz has joined #crystal-lang
jokke has quit [Quit: WeeChat 1.7.1]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]