<asterite>
did you consider using the clang c api to parse the headers? It might be easier (and more accurate)
waj has joined #crystal-lang
waj has joined #crystal-lang
e_dub has joined #crystal-lang
bcardiff has joined #crystal-lang
e_dub has joined #crystal-lang
waj has joined #crystal-lang
waj has joined #crystal-lang
asterite has joined #crystal-lang
dancinglightning has joined #crystal-lang
dancinglightning has left #crystal-lang [#crystal-lang]
<farleyknight>
asterite, I haven't looked into that yet. I started parsing the macros until I realized you could do (echo "#include <mysql/mysql.h>" | gcc -E -x c -) to get the file after all the macros were filled in.
<farleyknight>
I've tried looking for a way to query the symbols in .so and .a files but they don't have the function parameters, just the function names.
<asterite>
I see…
<farleyknight>
Unless I'm mistaken, I don't think static libraries have struct/enum definitions
<farleyknight>
So you'd want to parse those anyways.
<farleyknight>
But typedefs and structs are not hard to parse.
dancinglightning has joined #crystal-lang
<dancinglightning>
Hi @asterite
<asterite>
Hi @dancinglightning!
<asterite>
How's crystal? :)
<dancinglightning>
Yeah, how is crystal? It started well
<dancinglightning>
but then slowed down
<dancinglightning>
Actually when i hit the “dynamic” wall
<asterite>
But your language has a VM, right?
<dancinglightning>
Yes and no
<dancinglightning>
No, in that i am not interpreting. All code is compiled to machine instructions
<dancinglightning>
Yes in that the logic of ruby needs dynamic code. Not interpreting as such, but as you will well know, you can’t eliminate the dynamic in ruby
<dancinglightning>
An i don’t want to give up on ruby
<dancinglightning>
I have written a post about memory layout and the possibilities to avoid dunamic dispatch
<dancinglightning>
It is basically caching in binary code
<dancinglightning>
So part of the (final) system will recomile itself when needed
<dancinglightning>
And i never do a hash lookup for variables (and that means methods too)
<dancinglightning>
btw, is there a way to make this private @asterite
<asterite>
Yes, I guess :)
<asterite>
Why do you need the dynamism of ruby? Most of the time you can do just fine without it
<dancinglightning>
i like ducks, if it walks like a duck and talks like a duck . .. .
<dancinglightning>
At a minimum not having to specify all the time what type i am using
<asterite>
We use type inference for that, but we can't get too greedy or it becomes way too slow
<dancinglightning>
As i understand you noticed that it becomes impossible to infer the type in any reasonably sized program
<asterite>
(like, we have to specify the types of arrays and other generic classes)
<asterite>
Yes, exactly
<dancinglightning>
yes, that seems so c++
<dancinglightning>
and i was glad to leave that behind it brings templates and overloading with it
<asterite>
So your idea is to compile ruby code to native code?
<dancinglightning>
yes that is what i am doing
<dancinglightning>
I can already compile static code to machine code :-)
<asterite>
Do you have classes already?
<dancinglightning>
No, that is what i am working on
<dancinglightning>
but i know the memory layout
<asterite>
Because everything is more or less simple with numbers and other primitive types, but with classes, without types being specified, it gets very tricky
<dancinglightning>
Yes, but i distinguish between values and objects
<asterite>
We read a lot of papers about it, and all of them talked about the primitive cases, but nobody talked about the general case, when you have objects and methods without types
<dancinglightning>
values are your basic types
<dancinglightning>
yes
<dancinglightning>
you need to keep rtti for baic types basically
<dancinglightning>
i have a very compact memory layout for it
<asterite>
You need to keep rtti but only in the case of type unions (when you have mixed types)
<dancinglightning>
yes, i read that about the unions, very nice idea
<dancinglightning>
I have a mystery value, that would be the union of all possible baic types in your case
<dancinglightning>
with rtti you can then branch
<dancinglightning>
(i have 4 bits for basic type, 16 possibilities, but wth union it’s only 4. i have to see if i can use the idea actually)
<dancinglightning>
Sorry @asterite , i find this too strange to talk like this with the breaks
<dancinglightning>
I understand you are at work, so maybe we can chat or skype when you cave time
<asterite>
Sure
<dancinglightning>
so what time / day
<asterite>
Mmm...
<asterite>
Tell me when you can
<asterite>
But… what we will be discussing specifically?
<dancinglightning>
today for 1 or 1.5 hours
<dancinglightning>
and i should think we discuss our crystals
<dancinglightning>
or your morning, any really
<asterite>
Tomorrow is better for me
<asterite>
What time is there where you are?
<asterite>
(now)
<asterite>
Mmm… I guess he didn't read that :-P
dancinglightning has joined #crystal-lang
<dancinglightning>
So @asterite , i stop coding now. You can reach me in skype, i’ll hear when it rings. It does message too if you want to do another time.