<asterite>
check for the Macros module, you can see the list of methods you can invoke in macros
<asterite>
If there's something missing or something that's not very clear, let me know :-)
<asterite>
I'll also be adding more docs on everything... I think we (specially jhass!) are starting to answer the same questions over and over, so I hope this can make it easier for all of us
<jhass>
asterite: mind opping for a moment? I think your os x inserted weird chars into the topic
asterite has quit [Client Quit]
asterite has joined #crystal-lang
<jhass>
/mode + jhass ;)
<jhass>
er, +o
<asterite>
hi
<asterite>
Mmm...
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vUqiQ
<crystal-gh>
crystal/master 21206c7 Ary Borenszweig: Added links to docs and API in readme
<jhass>
oh, /mode #crystal-lang +o jhass actually I guess, I'm afraid if you edit it, it'll just insert those weird spaces again
<jhass>
ty
<asterite>
:)
<asterite>
Question: should the docs about literals for numbers, range, arrays, etc., be in the official docs or in the standard library api?
<asterite>
I'm thinking the correct place is the docs
<asterite>
Yeah... I'll move the docs for the source to the docs then. I also think with GitBook you can generate a PDF, maybe, so you could read all of that offline... and if the literals are somewhere else then it would be incomplete
<travis-ci>
manastech/crystal#2322 (master - 21206c7 : Ary Borenszweig): The build was fixed.
<vikaton>
jhass, yeah, I had to add a "0" in the +=
<jeromegn>
jhass: any thoughts on translating "A NULL terminated array of NULL terminated char* strings" from C to Crystal? It's supposed to be an array of strings, just not sure how to express it in Crystal
<jeromegn>
I did UInt8**
<jhass>
jeromegn: wanderer_'s example didn't work?
<jeromegn>
jhass: I just copied that PointerIterator class in my project, seems to work fine!
<jhass>
yeah, maybe I should upstream it
<jhass>
needs a better name though
<jeromegn>
or maybe arr = [] of String; arr.from_pointer(pointer)
<jeromegn>
well, bad naming again...
<jhass>
yeah, main issue is that X** can mean two things, either you have n X* and you know n or it's 0-terminated
<jeromegn>
jhass: how do you valgrind with the crystal compiler? I tried: valgrind /usr/local/bin/crystal play.cr
<jeromegn>
I got the valgrind intro and then my puts but not the usual debug info
<jhass>
I guess /usr/local/bin/crystal is a shell wrapper
<jhass>
check what it looks like, setup the environment and invoke valgrind on the binary directly
waterlink has quit [Quit: Leaving.]
<jeromegn>
ah, you're right and that sets a bunch of ENV vars
<jeromegn>
could be interesting to have a --valgrind option
<jeromegn>
in crystal
<vikaton>
>> {"A" => "b"}.has_key?("A")
<DeBot>
vikaton: true
<jeromegn>
given the structs are empty in the .h files.. I won't be able to find out the size of them unless I do a small C script to determine them eh?
<jhass>
I guess
<jeromegn>
oh damn
<jeromegn>
apaprently empty structs are impossible
<jhass>
well, same old questions, do you need to access the fields, do you need to allocate it? no & no -> alias to Void*, no & yes -> just figure out the total size and use a single member with the right size
<jeromegn>
I need to allocate it
<jeromegn>
yea
<jeromegn>
that's what I'm doing
<jeromegn>
however mongo is being an ass
datanoise has quit [Quit: leaving]
<jhass>
so just sizeof it in C and be done with it
notfowl is now known as unclefowl
<jeromegn>
jhass: I wish... libmongoc has a lot of "private" stucts
unclefowl has quit [Excess Flood]
<jeromegn>
and I can't require the files directly, it raises an error that I can only require mongoc.h directly. so I commented out all those checks and now I can include it without error... however, now it just tells me it's undeclared
notfowl has joined #crystal-lang
<jeromegn>
oh wait
<jeromegn>
sizeof(struct _mongoc_cursor_t)) is what I'm looking for
<jeromegn>
1280
<jeromegn>
woot
<jeromegn>
big one
<jhass>
indeed
<jhass>
btw why do you need to uncomment the checks? just include mongo.h
<crystal-gh>
[crystal] asterite pushed 10 new commits to master: http://git.io/vU3bM
<crystal-gh>
crystal/master 8223242 Ary Borenszweig: Added dummy Iterator#each without a block
<crystal-gh>
crystal/master 617716f Ary Borenszweig: Added Int `upto`, `downto` and `to` iterators
<crystal-gh>
crystal/master 0f086fd Ary Borenszweig: Small fix in macro docs
<jeromegn>
love that guy ^
<jeromegn>
jhass: I'm not certain... it doesn't work if I just load mongoc.h.
<jeromegn>
BlaXpirit: https://github.com/datanoise/mongo.cr that was the goal all along. he basically did the same thing I wanted to do :) so now there's no need for me to do it.
sardaukar has joined #crystal-lang
sardaukar has quit [Quit: sardaukar]
<crystal-gh>
[crystal] porras opened pull request #648: Iterator#cons(n) (master...each-cons) http://git.io/vUskN
notfowl has quit [Changing host]
notfowl has joined #crystal-lang
notfowl has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
JBat has quit [Quit: Computer has gone to sleep.]
willlll has joined #crystal-lang
<willlll>
if I have a function that returns a union type of a few things and Int32, but I know in a particular case it’s only going to be the Int32, can I force it down to just be the Int32?
<vikaton>
>> "A A".chars.map &.ord.to_s(2).rjust(8, '0')
<jhass>
willlll: you can hint the compiler either by something like if x.is_a? Int32; code, raise unless x.is_a? Int32 or by casting (which is just a runtime check in that case) x = foo as Int32