jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals 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
Oliphaunte has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vinPQ
<crystal-gh> crystal/master 4e00257 Ary Borenszweig: HTTP::ChunkedContent: don't read next chunk as soon as one if consumed. Fixes #3270
ruby_ has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 244 seconds]
ruby_ has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#4e00257 (master - HTTP::ChunkedContent: don't read next chunk as soon as one if consumed. Fixes #3270): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/158043671
<DeBot> https://github.com/crystal-lang/crystal/issues/3270 (IO#gets is delayed by one character)
onethirtyfive has joined #crystal-lang
ruby_ has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 244 seconds]
willl has quit [Quit: Connection closed for inactivity]
ruby_ has quit [Remote host closed the connection]
ruby_ has joined #crystal-lang
ruby_ has quit [Remote host closed the connection]
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tomchapin has joined #crystal-lang
tomchapin has quit [Read error: Connection reset by peer]
tomchapin has joined #crystal-lang
tomchapi_ has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
willl has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
ruby_ has joined #crystal-lang
ruby_ has quit [Remote host closed the connection]
onethirtyfive has joined #crystal-lang
pawnbox has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 250 seconds]
pawnbox has quit [Ping timeout: 252 seconds]
Oliphaunte has quit [Remote host closed the connection]
ruby_ has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
ponga has joined #crystal-lang
snsei_ has joined #crystal-lang
Oliphaunte has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has quit [Ping timeout: 252 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
ruby_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
ruby_ has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
vinalencc has joined #crystal-lang
vinalencc has left #crystal-lang [#crystal-lang]
ruby_ has quit [Remote host closed the connection]
ruby_ has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
akwiatkowski has joined #crystal-lang
onethirtyfive has joined #crystal-lang
<txdv> llvm 4.0 getting coroutines
onethirtyfive has quit [Ping timeout: 255 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
mark_66 has joined #crystal-lang
ruby_ has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
<FromGitter> <sdogruyol> It's already compiling in 3.9
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
Nik736 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
globalkeith has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 252 seconds]
ome has joined #crystal-lang
ruby_ has joined #crystal-lang
ruby_ has quit [Ping timeout: 244 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 265 seconds]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
A124 has quit [Ping timeout: 250 seconds]
soveran has quit [Remote host closed the connection]
bjz has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 265 seconds]
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Philpax has quit [Quit: Leaving]
globalkeith has joined #crystal-lang
soveran has joined #crystal-lang
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 265 seconds]
tomchapi_ has joined #crystal-lang
tomchapin has quit [Ping timeout: 244 seconds]
globalkeith has joined #crystal-lang
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ome has quit [Quit: Connection closed for inactivity]
globalkeith has joined #crystal-lang
Philpax has joined #crystal-lang
m4t has joined #crystal-lang
<m4t> hi :)
<m4t> I'm discovering crystal and try to create a macro that define a NamedTuple and should to be used in another macro, but I'm stuck with an error
<m4t> can I achieve something like that?
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
globalkeith has joined #crystal-lang
globalkeith has quit [Client Quit]
globalkeith has joined #crystal-lang
<BlaXpirit> m4t, well you aren't wrong to expect this to work. i couldn't achieve a good result with this kind of layout
<BlaXpirit> unfortunately if you want to combine multiple macros, seems like that's possible only by calling a macro inside a macro
ruby_ has joined #crystal-lang
<BlaXpirit> yeah it would be a great feature to have
ruby_ has quit [Ping timeout: 244 seconds]
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<m4t> Ok, In fact I have no access to the « do_something » macro (it's a library defined), so I can't call my macro
<m4t> I will stop being lazy and define my NamedTuple manually ^^
<m4t> or maybe there is an other way to dynamically create a NamedTuple from a range ?
soveran has joined #crystal-lang
<m4t> or not, I can't even store it in a variable, I got the same exception
<BlaXpirit> m4t, yeah :( I wish there was a way. strange that I never ran into such a situation
Oliphaunte has joined #crystal-lang
<BlaXpirit> the expression passed to a macro is passed as a syntax tree, without resolving any variables
<BlaXpirit> it's important because what if the variable/method doesn't exist but the macro still wants the expression to be valid?
A124 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
<m4t> I don't know, it's too deep in crystal internals for me :p
onethirtyfive has joined #crystal-lang
crystal-lang468 has joined #crystal-lang
globalkeith has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 276 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit []
tilpner_ has joined #crystal-lang
ruby_ has joined #crystal-lang
tubbo has left #crystal-lang ["outie 5000"]
akwiatkowski has quit [*.net *.split]
tilpner has quit [*.net *.split]
bjmllr has quit [*.net *.split]
Tophe has quit [*.net *.split]
Davy_CC has quit [*.net *.split]
leafybasi has quit [*.net *.split]
tilpner_ is now known as tilpner
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 250 seconds]
ruby_ has quit [Remote host closed the connection]
ruby_ has joined #crystal-lang
ruby_ has quit [Ping timeout: 244 seconds]
bjmllr has joined #crystal-lang
Davy_CC has joined #crystal-lang
Tophe has joined #crystal-lang
akwiatkowski has joined #crystal-lang
leafybasi has joined #crystal-lang
ruby_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/viCvZ
<crystal-gh> crystal/master 8e723f5 Ary Borenszweig: Compiler: never skip zero initializers. Fixes #3272
pawnbox has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 244 seconds]
willl has joined #crystal-lang
<crystal-gh> [crystal] maiha opened pull request #3275: Compiler: mark LLVM return type as Nil when program ends with no typed ASTNode (master...typeless-as-nil) https://git.io/viCkI
<FromGitter> <Sija> anyone knows how to define array of pointers in type grammar?
<FromGitter> <Sija> sth like `enum sp_return sp_list_ports (struct sp_port *** list_ptr)`
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
<FromGitter> <Sija> there’s always `Void*` but maybe there’s some “proper” way of doing that I've missed
crystal-lang468 has quit [Ping timeout: 264 seconds]
<RX14> @Sija, you you mean a crystal array of pointers or what?
<RX14> a C array would just be Void**
<FromGitter> <Sija> I mean pointer to array of C struct pointers
<RX14> so struct **?
<RX14> or struct ***
<RX14> either way it's the same in crystal
<RX14> define your struct in lib
<RX14> then struct**
<FromGitter> <Sija> in C it’s `struct sp_port ***`
<RX14> as the type
<RX14> so it's struct*** in crystal
<RX14> it's the same
<FromGitter> <Sija> and how I’d pass it to C?
<FromGitter> <Sija> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57d03b6c9506796a16e5dcdd]
<FromGitter> <Sija> like this?
<RX14> no
<RX14> because thats a crystal array
<RX14> you need to call to_unsafe on the array
<RX14> so Array(LibSerialPort::Sp_port*)#to_unsafe would return LibSerialPort::Sp_port**
<RX14> so then you need another pointerof() to get to ***
<FromGitter> <Sija> got it, thx @RX14!
<FromGitter> <Sija> hmm, but since it’s Crystal Array will it work while being populated from the C-side, along with `\NULL` terminator?
<RX14> ...populated
<RX14> if the pointer changes
<RX14> then you;re going to have to make a new array from the pointer
ruby_ has quit [Remote host closed the connection]
onethirtyfive has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
onethirtyfive has quit [Ping timeout: 252 seconds]
pduncan has quit [Read error: Connection reset by peer]
<travis-ci> crystal-lang/crystal#8e723f5 (master - Compiler: never skip zero initializers. Fixes #3272): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/158204968
<DeBot> https://github.com/crystal-lang/crystal/issues/3272 (Inheritance appears to not work correctly)
ruby_ has joined #crystal-lang
mark_66 has quit [Quit: Leaving.]
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
mgarciaisaia1 has joined #crystal-lang
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 264 seconds]
<FromGitter> <wrq> asterite, prepare to be *notorious*
<RX14> @wrk, your aggressive comments don't really help your cause
<FromGitter> <wrq> why? because it offends you? makes you uncomfortable?
<FromGitter> <wrq> fuel for the cause, tbh. freedom isnt about what you find appealing
<RX14> true, but asterite is *free* to regulate his community how he wishes, and I can certainly understand asterite not wanting true freedom if that means dealing with people like you
<FromGitter> <wrq> not exactly
<FromGitter> <wrq> a crystal fork will eventually be organized
<RX14> ok, so of all the projects who have a code of conduct
<RX14> exactly how many have *succesfully* forked because of dissent to it?
<FromGitter> <wrq> im not sure what you're asking
<RX14> you're wording it as if anybody gives a shit
<RX14> which i disagree with
<FromGitter> <wrq> ok
<FromGitter> <wrq> cool
<RX14> i would mildly prefer for the CoC to be removed
<FromGitter> <wrq> almost everyone in that thread wants it gone
<RX14> but i don't think that the community is t all willing to fork over it
<FromGitter> <wrq> i didnt say the community
<FromGitter> <wrq> manas doesnt have a lot of money to actually fund crystal. once it gets more featureful, with some of my extensions, and a little bit more elbow grease, a fork could attract much more substantial sponsors
<FromGitter> <wrq> thats the beauty of FOSS
<RX14> yes but forks need a reason
<FromGitter> <wrq> wrong
<RX14> and the CoC is not reason enough to get a single company behind you
<FromGitter> <wrq> forks need maintainers, developers, and money
<RX14> yes
<RX14> and those generate additional work on the fork
<RX14> which can progress the fork beyone the original
<RX14> which is
<RX14> oh guess what
<RX14> a reason
<FromGitter> <wrq> i cant parse whatever you just said
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 244 seconds]
pduncan has joined #crystal-lang
pduncan has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] bcardiff opened pull request #3276: Add WeakRef class (master...feature/weakref) https://git.io/viCoT
m4t has quit [Remote host closed the connection]
<FromGitter> <Sija> @RX14: how would you implement `sp_list_ports` usage from https://chromium.googlesource.com/chromiumos/third_party/libsigrok/+/refs/heads/master/src/serial.c#909 in Crystal?
<BlaXpirit> Sija, possibly sp_list_ports(out ports) , copy that into an array, sp_free_port_list(ports)
<BlaXpirit> copy into an array part optional - that is if u want to expose it as a proper crystal library
<FromGitter> <Sija> with fun declaration like `fun sp_list_ports(list_ptr : Void*) ...`?
<BlaXpirit> Sija, hm then you can't copy into an array.
<BlaXpirit> it would still have to be sp_port ** or a different approach is needed
<BlaXpirit> show definition of struct sp_port
<BlaXpirit> Sija, slightly scary but I see no reason to replace sp_port with void*
<FromGitter> <Sija> yes, but there’s no `***` notation in type grammar
<BlaXpirit> I recommend to define this as a struct and work with it normally - no void* involved
qard has joined #crystal-lang
<BlaXpirit> Sija, isn't there? I'm quite sure there is
<RX14> yes, there is
<RX14> it's * is an operator
<RX14> so you can have as many of them as you want
<RX14> saying there's no foo*** is like saying that !!!foo doesn't exist because !!! isn't explicitly defined
<RX14> really, it's an application of 3 operators
<RX14> Foo* means Pointer(Foo)
<RX14> that's it
<RX14> Foo*** means Pointer(Pointer(Pointer(Foo)))
<FromGitter> <Sija> yup, I didn’t check that, my bad!
qard has quit [Client Quit]
qard has joined #crystal-lang
qard has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
<FromGitter> <Sija> ok, that works but how to convert it back to Crystal Array?
crystalious has joined #crystal-lang
<FromGitter> <Sija> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57d06d7b9506796a16e5e389]
<Yxhuvud> .. why on earth would anyone think a code of conduct is a: worth forking for and b: a CoC-less project would get more support than one with a CoC?
<FromGitter> <Sija> throws `Invalid memory access (signal 11) at address 0x1` :/
<BlaXpirit> Sija, you're trying random stuff :( Array can be an arbitrarily complex data structure, while 'ports' is just a pointer, which is just a number
<BlaXpirit> and you're casting one to another
<FromGitter> <Sija> hmm, that’s supposed to be a pointer to a `\NULL` terminated array of pointers of `LibSerialPort::Sp_port` structures
<BlaXpirit> array == pointer that happens to point to an allocated block of memory
<BlaXpirit> it being null terminated complicates things
<FromGitter> <Sija> yes, i know that, thank you. it’s more about the complications i’m coming here
<BlaXpirit> Sija, `arr = [] of LibSerialPort::Sp_port; while ports; arr << ports.value; ports += 1; end`
<FromGitter> <Sija> `Invalid memory access (signal 11) at address 0x7fdfc0500000`
<BlaXpirit> please show how you defined the function in crystal. and the code itself has a chance to contain a mistake too
<BlaXpirit> and don't forget about the `!= SP_OK` part - in fact, it might be "not ok"
<FromGitter> <Sija> it does return `SP_OK`
<BlaXpirit> wait, is it a triple pointer?
<FromGitter> <Sija> yes, it is
<BlaXpirit> alright, so I guess it doesn't copy the structs but gives pointers. well the simple solution is to replace the code `ports.value` with `ports.value.value`
<BlaXpirit> but at this point it's worth to think if it's worth trying to prevent the copying
<BlaXpirit> but how did that compile in the first place? I must be making a mistake again
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<FromGitter> <Sija> but here i always get `Invalid memory access (signal 11) at address …`
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<BlaXpirit> well this doesn't actually extract the structs but passes on the pointer
<FromGitter> <Sija> and I’ve tried your suggestions, tho’ it _does_ return *pointers*, not structs themselves
<FromGitter> <Sija> well, yes
<FromGitter> <Sija> that’s what libserialport returns
qard has joined #crystal-lang
<FromGitter> <Sija> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57d0726f9506796a16e5e437]
<FromGitter> <Sija> this kinda works (at least returns `SP_OK` and there’s no `Invalid memory` error)
perks has joined #crystal-lang
<FromGitter> <Sija> but `arr` is always empty
<BlaXpirit> arr.to_unsafe might be a null pointer
<FromGitter> <Sija> it _is_ a null pointer… so what?
<FromGitter> <Sija> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57d072f59506796a16e5e455]
<BlaXpirit> anyhow, this is definitely not a step in the right direction
<BlaXpirit> I don't see why it breaks. the *gist* you last posted looks perfect to me
<FromGitter> <Sija> my guess would be an issue with `\NULL` terminated Array
<BlaXpirit> Sija, have you tried printing those instead of adding them to an array? (please return to the code in the gist) - does it manage to print anything before failing?
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
perks has quit [Quit: perks]
<BlaXpirit> Sija, oh and I guess modifying the original pointer by doing +=1 wasn't such a good idea, because the original pointer is needed to pass to sp_free_port_list
<BlaXpirit> if only there was an easy way for me to debug this on site
<FromGitter> <Sija> u r on mac or linux?
<BlaXpirit> linux
<BlaXpirit> oh right. pacman -S libsigrok ?
<FromGitter> <Sija> if you’d like to play with it, it links with http://sigrok.org/wiki/Libserialport
<FromGitter> <Sija> uhm
<FromGitter> <Sija> i think i’ve found solution
<FromGitter> <Sija> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57d075fcfec98d0a4e232755]
<BlaXpirit> silly me, of course
<FromGitter> <Sija> thx for the help :)
<FromGitter> <BlaXpirit> ```i = 0 ⏎ while (v = ports[i]) ⏎ arr << v ⏎ i += 1 ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=57d07653f33967fc64391bcc]
<BlaXpirit> have to do this to be able to free the pointer afterwards
<FromGitter> <Sija> yep, that’s much better
perks has joined #crystal-lang
kulelu88 has joined #crystal-lang
perks has quit [Quit: perks]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 240 seconds]
Nik736 has quit [Quit: Textual IRC Client: www.textualapp.com]
snsei has joined #crystal-lang
crystalious has quit [Ping timeout: 264 seconds]
snsei has quit [Ping timeout: 264 seconds]
globalkeith has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
xmgx has joined #crystal-lang
willl has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
onethirtyfive has joined #crystal-lang
xmgx has quit [Remote host closed the connection]
soveran has quit [Ping timeout: 276 seconds]
onethirtyfive has quit [Ping timeout: 255 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 244 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 276 seconds]
bjz has joined #crystal-lang
perks has joined #crystal-lang
perks has quit [Client Quit]
tomchapi_ has quit [Read error: Connection reset by peer]
tomchapin has joined #crystal-lang
A124 has quit [Read error: Connection reset by peer]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
A124 has joined #crystal-lang
tomchapin has quit [Ping timeout: 260 seconds]
LastWhisper____ has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
akwiatkowski has quit [Ping timeout: 244 seconds]