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
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
<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>
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>
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
<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>
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