jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.15.0 | 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
Philpax_ has quit [Ping timeout: 276 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
<wmoxam> asterite: thanks!
broz has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwqLk
<crystal-gh> crystal/master bc9a3a5 TSUYUSATO Kitsune: Improve #1859, add binary searching methods (#1871)...
<crystal-gh> [crystal] asterite closed pull request #1859: Add Array#bsearch, Array#bsearch_index, Range#bsearch (master...bsearch) https://git.io/vwqLn
<travis-ci> crystal-lang/crystal#bc9a3a5 (master - Improve #1859, add binary searching methods (#1871)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/123794456
broz has joined #crystal-lang
broz has quit [Ping timeout: 260 seconds]
Philpax__ is now known as Philpax
A124 has quit [Read error: Connection reset by peer]
A124 has joined #crystal-lang
shawn42 has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
broz has joined #crystal-lang
broz has quit [Ping timeout: 244 seconds]
broz has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
broz has quit [Remote host closed the connection]
broz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
broz has quit [Remote host closed the connection]
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 276 seconds]
Philpax_ has quit [Ping timeout: 260 seconds]
nwmcsween has joined #crystal-lang
<nwmcsween> can a struct have a block within it?
<nwmcsween> struct baz { foo, &bar };
<nwmcsween> that hurts my brain - struct Baz foo &bar end
A124 has quit [Ping timeout: 276 seconds]
<BlaXpirit> nwmcsween, no, that's crazy
<BlaXpirit> but you can have a proc
<nwmcsween> I don't even need to store context I just need an array of callback functions on some state
<nwmcsween> where state is enum State Start Data End end
<nwmcsween> in C I would use a VLA of function pointers and iterate
<nwmcsween> in crystal I have no idea
<rkeene> In Crystal you can use a closure/procs
<nwmcsween> but I don't need to save context
<rkeene> So ? It's only a closure if it references the state.
soveran has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
Philpax_ has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
trapped has joined #crystal-lang
<nwmcsween> does crystal do optimizations based on reference checks within no context 'closure'? As in does calling a closure with say 1000 variables without using them incur memory overhead
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<rkeene> Well, it knows if a block is a closure or not, so it certainly could
Philpax_ has quit [Read error: Connection reset by peer]
Philpax_ has joined #crystal-lang
soveran has joined #crystal-lang
<nwmcsween> how do you add a proc to a struct? struct Foo cb : _ -> _ end?
<BlaXpirit> >> struct Foo; cb : ->; end
<DeBot> BlaXpirit: declaring the type of a local variable is not yet supported - https://carc.in/#/r/wsu
<BlaXpirit> noonono
<BlaXpirit> >> struct Foo; @cb : ->; end
<DeBot> BlaXpirit: #=> nil - https://carc.in/#/r/wsv
mark2 has joined #crystal-lang
mark2 has quit [Client Quit]
mark_66 has joined #crystal-lang
Philpax_ has quit [Ping timeout: 250 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Netfeed has joined #crystal-lang
Netfeed has quit [Changing host]
trapped has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
brunto has joined #crystal-lang
rolha has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
sdogruyol has joined #crystal-lang
<sdogruyol> hey all
pawnbox has joined #crystal-lang
<soveran> hey sdogruyol
<sdogruyol> hey soveran how’s ohm port going :)
<soveran> mostly fine, but I think may have hit a barrier
<soveran> there's a feature in Ohm where you can chain many finders: Ohm.find(...).except(...).combine(...)
<soveran> internally, it builds a query using something like s-expressions
<soveran> (using nested arrays)
<soveran> and I can't find the right type for that
<soveran> usually crystal complains that it's too nested or something like that
<soveran> (even if the array has three levels)
<soveran> luckily, it's not that fundamental as a feature, so it is usable without that kind of chaining.
<BlaXpirit> soveran, dunno, looks very doable
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<soveran> BlaXpirit: the library that solves the s-expression types it as Array, and it works fine in the tests
<soveran> the problem is when I want to build the s-expression incrementally in Ohm
rolha_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
rolha has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
<jokke> asterite: i've followed the "The next step" issue for a while and since it's closed i'd like to know what the status is. Would this get rid of the problem where instance variable types from subclasses are "unionated" with the parent class instance variable types?
<jhass> jokke: see #2443
<jokke> jhass: ah thanks!
<jhass> (and #2390 as referenced there)
Philpax has joined #crystal-lang
<jokke> jhass: maybe you can help me out here :/ I'm a bit stuck. I try to write bindings for a c api which is actually generated by gobject from c++ code. So there are kinda things like inheritance. I have two handlers: Database and WritableDatabase. WritableDatabase is a subtype of Database. I try to implement the bindings so that i have crystal classes for the two and use inheritance. However it's hard when
<jokke> the c lib needs the handler of a Database and i pass it a WritableDatabase. Is there any smart way to implement this?
<jhass> "hard"?
<jokke> uh yeah that was badly described :D i mostly just get type errors whatever i try.
<jokke> because the handler seems to be a union type
<jhass> the discussion in https://github.com/crystal-lang/crystal/issues/2460 might shed some light
pawnbox has quit [Remote host closed the connection]
<jokke> hm ok
<jokke> jhass: i guess i'm still not getting it: https://p.jreinert.com/m-E1G/
<jokke> gives me this error: https://p.jreinert.com/WHe/
<jokke> do i really have to cast the pointer and then get the value?
<jhass> why is it not a pointer type in the first place?
<jhass> does it really take the whole struct(?)?
<jokke> hm no, LibXapian::Database is just defined as Void*
<jokke> do you mean i should use LibXapian::Database* ?
<jokke> etc
<jhass> I guess so
<jokke> hm ok
<jhass> and define it as Void or whatever
<jokke> yeah
<jokke> i see
<jokke> ok
<jokke> jhass: ...
<jokke> in ./src/xapian/database.cr:24: can't cast (Pointer(LibXapian::Database) | Pointer(LibXapian::WritableDatabase)) to Pointer(LibXapian::Database)
<jhass> tried using alias instead of type to define them?
<jokke> jhass: no. I like the strictness of type
<jokke> i don't get why i can't cast pointers as i wish
<jhass> idk it refuses to cast out of the union here rather
<jhass> for whatever reason
<jokke> here's the code: https://p.jreinert.com/m-GND5hY/
<jhass> if you think you got a bug, producing a minimal self contained example to reproduce it will get it fixed 20 times faster
<jokke> yeah. i just don't know if it's a bug or not
<jhass> if you think it's something you don't understand, producing a minimal self contained example will make it easier for other people to recognize and explain the issue, or even make it click on your own
<jhass> you keep posting huge code pastes, often not even runnable locally
<jokke> yeah that's true
<jhass> digging through that is quite some effort
<jokke> sorry bout that
<jokke> i'll try to make a minimal working example
<jokke> *failing
<jokke> :)
<jhass> :)
<jhass> and feel free to open an issue then, as asterite is likely the better person to explain it here and well, your working hours don't quite match up ;)
<jokke> yeah :)
<jhass> also make sure it still reproduces with head
<jhass> especially in regard to #2443
<jokke> hm yeah
<jokke> good point
<jokke> jhass: tadaa! https://p.jreinert.com/A85D/ruby
<jokke> jhass: do you have HEAD installed?
<jokke> jhass: if so, would you mind trying to run that?
<jhass> I'm refreshing my head compiler atm ;)
<jhass> and when you use alias instead it just works (so you never tried my earlier suggestion I guess)
<jhass> if you consider that a bug... you know what to do ;)
<jokke> alias is not an option imo
<jokke> oh wow
<jokke> that sucks
<jokke> why can't i change instance var types?
<jokke> well it does kinda make sense..
<jokke> hm this is quite the annoying problem
pawnbox has joined #crystal-lang
<jokke> jhass: alias would allow to use LibXapian::Database instead of LibXapian::WritableDatabase which violates the liskov substitution principle
<jokke> would be nice if there were somekind of one-way alias ;)
A124 has joined #crystal-lang
<jokke> :)
<jokke> alright alright
<BlaXpirit> jokke, do you have type LibXapian::Database = Void* ?
<jokke> no just Void
<BlaXpirit> jokke, uh ok... anyway, change type -> alias . problem solved
<jokke> as i said it makes the lib less type safe
<BlaXpirit> jokke, but you don't intend this to be used directly
<jokke> yeah
<jokke> still it doesn't feel right
trapped has joined #crystal-lang
<Davy_CC> I tried the code in page 9 from this slide http://www.slideshare.net/crystallanguage/por-qu-crystal-why-crystal-language
<Davy_CC> but it seems have some bug there
rolha_ has quit [Read error: Connection reset by peer]
rolha has joined #crystal-lang
rolha has quit [Read error: Connection reset by peer]
<Davy_CC> aha i found the problem
pawnbox has quit [Remote host closed the connection]
rolha has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
unshadow has joined #crystal-lang
TheLemonMan has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<soveran> is there a way to make something like this work? https://gist.github.com/soveran/6264efd9e215a3409cc75c25fb5fd1df
<jhass> soveran: not with stdlib spec, no. if you define describe yourself you could make it a macro I guess and paste class definitions etc to the toplevel
<soveran> jhass: I mean the code that is being tested
brunto has quit [Ping timeout: 260 seconds]
<soveran> (I'm using crotest for the tests)
<soveran> the problem is how to type @expr so that something like this works
guilleiguaran___ has joined #crystal-lang
<jhass> soveran: https://carc.in/#/r/wti
<jhass> let's see if head still likes that
g3funk has joined #crystal-lang
brunto has joined #crystal-lang
slash_ni1k has joined #crystal-lang
<jhass> it does!
jamie_ has joined #crystal-lang
ssvb_ has joined #crystal-lang
Tophe__ has joined #crystal-lang
braidn has quit [Ping timeout: 260 seconds]
guilleiguaran__ has quit [Ping timeout: 260 seconds]
jamie_ca has quit [Ping timeout: 260 seconds]
mroth has quit [Ping timeout: 260 seconds]
Cyrus has quit [Ping timeout: 260 seconds]
ssvb has quit [Ping timeout: 260 seconds]
Netfeed has quit [Ping timeout: 260 seconds]
Tophe_ has quit [Ping timeout: 260 seconds]
slash_nick has quit [Ping timeout: 260 seconds]
<soveran> jhass: excellent! I'll try to see if it solves my use case
Cyrus has joined #crystal-lang
Cyrus is now known as Guest82863
<jhass> soveran: btw smells like it could benefit from using tuples instead of arrays
jamie_ is now known as jamie_ca
<soveran> jhass: in the actual context, the resulting expr is passed to Stal: https://github.com/soveran/stal-crystal
<soveran> jhass: these are my first libraries in crystal, so maybe the code is not idiomatic at all
<jhass> we're still building up the idioms anyway ;)
unshadow has quit [Quit: leaving]
guilleiguaran___ is now known as guilleiguaran__
Tophe__ has quit [Ping timeout: 276 seconds]
<jhass> jokke: 0.13 is quite old by our standards by now :o
Tophe__ has joined #crystal-lang
mroth has joined #crystal-lang
<jokke> jhass: well.. 0.8.0 is in the arch repos..
<jhass> uhm, no
<jhass> 0.15 is
<jokke> huh?
<jokke> oh
<jokke> weird
<jokke> wy did it show crystal 0.8.0...
<jokke> wtf
<jokke> ah
<jokke> aaah i think it's MrZYX_crystal_crystal
<jokke> yeah that was it
dsounded has joined #crystal-lang
<dsounded> hello, fellas
Papierkorb has quit [Ping timeout: 276 seconds]
<jokke> jhass: 0.15.0 produces the same error. i updated the issue
Papierkorb has joined #crystal-lang
<jokke> dsounded: o/
Netfeed has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Netfeed has joined #crystal-lang
Netfeed has quit [Changing host]
Philpax has quit [Ping timeout: 246 seconds]
pawnbox has joined #crystal-lang
<jhass> jokke: that's why you add additional repos at the bottom :P
<jokke> :)
pawnbox has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
pawnbox has joined #crystal-lang
dsounded_ has joined #crystal-lang
dsounded has quit [Read error: Connection reset by peer]
shawn42 has quit [Quit: Connection closed for inactivity]
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
Philpax_ has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
dsounded_ has quit [Remote host closed the connection]
shawn42 has joined #crystal-lang
<soveran> jhass: forgot to tell you that it worked perfectly, thanks a lot :-)
<jhass> <3 yw
broz has joined #crystal-lang
dsounded has joined #crystal-lang
<sdogruyol> jhass soveran nice job!
<soveran> sdogruyol: thanks :-) Ohm is almost there
<sdogruyol> soveran wow!
broz has quit [Remote host closed the connection]
dsounded has quit [Remote host closed the connection]
broz has joined #crystal-lang
Philpax has quit [Ping timeout: 250 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
mgarciaisaia1 has joined #crystal-lang
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
broz has quit [Remote host closed the connection]
mgarciaisaia1 has joined #crystal-lang
mgarciaisaia1 has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
mgarciaisaia1 has joined #crystal-lang
brunto has quit [Ping timeout: 246 seconds]
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
matp has quit [Remote host closed the connection]
mgarciaisaia has joined #crystal-lang
matp has joined #crystal-lang
broz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
Renich has joined #crystal-lang
Guest82863 is now known as Cyrus
Cyrus has joined #crystal-lang
Cyrus has quit [Changing host]
mgarciaisaia has left #crystal-lang [#crystal-lang]
mark_66 has quit [Remote host closed the connection]
dsounded has joined #crystal-lang
dsounded has quit [Ping timeout: 276 seconds]
ozra has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #2476: Use `$HOME/.crystal` as the default cache dir. (master...feature/home_crystal) https://git.io/vwmjm
mgarciaisaia has left #crystal-lang [#crystal-lang]
tamole has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #2477: File::Stat: return local time for atime, ctime and mtime (master...feature/file_stat_local_time) https://git.io/vwYfl
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
endou has quit [Ping timeout: 260 seconds]
endou has joined #crystal-lang
mgarciaisaia1 has joined #crystal-lang
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
<crystal-gh> [crystal] asterite opened pull request #2478: When doing `crystal file.cr x y z`, assume `x y z` are program arguments (master...feature/crystal_run_single_file) https://git.io/vwYYd
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
tamole has quit [Quit: ...]
tamole has joined #crystal-lang
tamole has quit [Client Quit]
mgarciaisaia has joined #crystal-lang
Renich has quit [Ping timeout: 246 seconds]
Renich has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
mgarciaisaia has left #crystal-lang [#crystal-lang]
mgarciaisaia has joined #crystal-lang
Renich has quit [Ping timeout: 240 seconds]
mgarciaisaia has left #crystal-lang [#crystal-lang]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
mgarciaisaia1 has joined #crystal-lang
mgarciaisaia1 has quit [Client Quit]
jhass has joined #crystal-lang
DeBot has joined #crystal-lang
jhass has quit [Changing host]
DeBot has quit [Changing host]
sp4rrow has joined #crystal-lang
emancu_ has joined #crystal-lang
emancu has quit [Read error: Connection reset by peer]
emancu_ has quit [Read error: Connection reset by peer]
emancu has joined #crystal-lang
emancu_ has joined #crystal-lang
emancu has quit [Read error: Connection reset by peer]
DeBot has quit [Quit: Crystal IRC]
DeBot has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
emancu_ has quit []
sp4rrow has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
DeBot has quit [Quit: Crystal IRC]
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia1 has joined #crystal-lang
DeBot has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<jokke> hi
<jokke> asterite: you there?
<jokke> regarding the issue with the handler pointers: I tried doing as you said: use the most generic pointer type and cast when needed
<jokke> but now some type assertions in the lib say i pass wrong typs
<jokke> *types
<jokke> this is how the code looks now: https://p.jreinert.com/m-89yCh/
<jokke> and i get multiple errors like this: (process:867): XapianGlib-CRITICAL **: void xapian_term_generator_set_database(XapianTermGenerator*, XapianWritableDatabase*): assertion 'XAPIAN_IS_WRITABLE_DATABASE (database)' failed
<jokke> ok that's a bad example since it's not in the code i pasted
<jokke> (process:867): XapianGlib-CRITICAL **: gboolean xapian_writable_database_add_document(XapianWritableDatabase*, XapianDocument*, unsigned int*, GError**): assertion 'XAPIAN_IS_WRITABLE_DATABASE (self)' failed
<jokke> that's better
<jokke> is this a bug or am i doing something wrong?
<jokke> i'm suspecting the latter
<jokke> :)
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
emancu has joined #crystal-lang
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
tubbo is now known as epicwife
rok has joined #crystal-lang
sp4rrow has joined #crystal-lang
pawnbox has joined #crystal-lang
swav has quit [Ping timeout: 260 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
swav has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
epicwife is now known as tubbo
soveran has quit [Remote host closed the connection]
rok has quit [Quit: rok]
soveran has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
soveran has quit [Remote host closed the connection]
sp4rrow_ has joined #crystal-lang
sp4rrow has quit [Ping timeout: 240 seconds]
emancu has quit []
Raimondi has quit [Ping timeout: 252 seconds]
A124 has quit [Ping timeout: 276 seconds]
Raimondi has joined #crystal-lang
kulelu88 has joined #crystal-lang
A124 has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 252 seconds]
shawn42 has quit [Quit: Connection closed for inactivity]
A124 has quit [Ping timeout: 276 seconds]
A124 has joined #crystal-lang
sp4rrow_ has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
Philpax has quit [Ping timeout: 276 seconds]