<FromGitter>
<Blacksmoke16> @phangs the guide should be good to go now
<FromGitter>
<wontruefree> I am having trouble with crystal_lib and a header file from a project I am trying to generate a lib for. Is there a difference between cpp header files and c header files?
<FromGitter>
<wontruefree> I am kind of at a loss
<FromGitter>
<wontruefree> There is some errors with *attribute* which makes me think it is a cpp problem
chachasmooth has quit [Ping timeout: 246 seconds]
<FromGitter>
<christopherzimmerman> Are you trying to link a c lib or a cpp lib?
chachasmooth has joined #crystal-lang
<FromGitter>
<watzon> @wontruefree you can't link to a cpp library, you'd have to write a c wrapper for it and then link to that
<FromGitter>
<christopherzimmerman> Currently, I have to have a separate indexing method for both of these cases, which feels a bit clunky.
<FromGitter>
<tenebrousedge> there is a union return type in that function. You can use conditionals later to narrow it
<FromGitter>
<tenebrousedge> can you return `[3]` for a single result?
<FromGitter>
<tenebrousedge> or not use `*` and have two `[]` methods?
<FromGitter>
<Blacksmoke16> yea id use two overloads
<FromGitter>
<christopherzimmerman> The real problem is that this needs to be generalized for n dimensions, and I don't know how I can do anything other than splat since ndims won't be known at compile time.
<FromGitter>
<christopherzimmerman> I kind of like the idea of never actually returning scalars, and instead just returning single element containers.
<FromGitter>
<christopherzimmerman> then having a method to convert that to a scalar if the user really needs it.
<FromGitter>
<tenebrousedge> :plus1:
duane has quit [Ping timeout: 245 seconds]
<hightower2>
crystal-ann seems down
<FromGitter>
<christopherzimmerman> @tenebrousedge definitely much more readable. Before I was only accepting an array of integers as an argument if they were after a scalar but it would break if it wasn't the right length, etc.. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dd5592bbebeec417b98b5e8]
<FromGitter>
<tenebrousedge> why `item`? why not `t[0, 1, 1][0]` ?
<FromGitter>
<christopherzimmerman> That would return the same thing as `t[0, 1, 1]`
<FromGitter>
<christopherzimmerman> If I always return tensors from indexing operation.
<hightower2>
the first one returns what I'd expect
<hightower2>
the second one, at a glance I'm not sure why it returns what it does
<FromGitter>
<christopherzimmerman> Tuples know what type of element is in each position, arrays do not AFAIK
<FromGitter>
<tenebrousedge> correct
<FromGitter>
<christopherzimmerman> So you will get the union type if you return the latter.
<hightower2>
ah yes, yes,... that's the explanation
<hightower2>
well that's what I meant that array didn't work as expected
<hightower2>
thanks
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<hightower2>
mm.. so, I have a list of 1500 Procs which are generated dynamically at program startup. I can't keep them in a named tuple because the size limit of the tuples is 300 entries. So I currently have a Hash, but this doesn't know the type of each Proc.
<hightower2>
Is there some convenient data structure where I could store them, and have the type of each one known, instead of treating it as an union of all types like a Hash does?
<FromGitter>
<Blacksmoke16> could you have a wrapping type?
<FromGitter>
<Blacksmoke16> like `Handler(T)`
<FromGitter>
<Blacksmoke16> which would be essentially `Hash(String, Handler)`?
<FromGitter>
<asterite> you could have multiple hashes?
<FromGitter>
<asterite> why do you need 1500 procs?
<hightower2>
It's a program which reads the terminfo file and then configures itself to be able to output all the terminfo functions to the terminal. The real count is about 1/3rd of that number, and the other 2/3ds are aliases/alternative names
<hightower2>
I could probably drop the amount of Procs to below 300 if I make it so that I don't create Procs for those which just return their input or a fixed value.
<hightower2>
But I wanted to avoid having to check for type of value before determining whether I should use it directly or #call() it
<hightower2>
Yeah Blacksmoke16 I thought about it... I'll try all the suggested/mentioned approaches combined - not using Procs when the value is just literal, and handling the rest with a wrapper type possibly
<FromGitter>
<asterite> what are the different proc types that you have? are there many combinations?
<hightower2>
Yes because they depend on the definitions from the terminfo file... large majority takes no input and returns Bool|Int|String. But those that do take input, the input can have any number of args
<hightower2>
From 1 to 10
<hightower2>
let me check something...
<FromGitter>
<Blacksmoke16> could you group the procs based on the number of args they have
<FromGitter>
<manveru> here's a bit of strace output, but not sure that helps much
<FromGitter>
<tenebrousedge> did you try adding `--error-trace` to your invocation?
<FromGitter>
<manveru> yeah
<FromGitter>
<tenebrousedge> is there a recent code change that triggered this? can you comment out lines of code until something works, or maybe use git-bisect?
<FromGitter>
<manveru> i think i found the cause
<FromGitter>
<manveru> this will be a fun hunt for the actual root cause though :)