qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Renich has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
havenwood has joined #crystal-lang
Renich has quit [Quit: leaving]
sadin has quit [Remote host closed the connection]
BlaXpirit has quit [Quit: Konversation]
asbradbu1y has quit [Ping timeout: 255 seconds]
asbradbury has joined #crystal-lang
buggs has quit [Ping timeout: 264 seconds]
buggs has joined #crystal-lang
nakilon has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
leafybas_ has joined #crystal-lang
nakilon has quit [Ping timeout: 264 seconds]
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #crystal-lang
<jhass>
dzv: it's still open?1
<dzv>
oops. i was looking at the closed message on a referenced PR
elia has joined #crystal-lang
fowlduck has joined #crystal-lang
fowlduck has quit [Remote host closed the connection]
leafybas_ has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 255 seconds]
leafybasil has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
ponga has quit [Quit: Connection closed for inactivity]
fowlduck has joined #crystal-lang
<crystal-gh>
[crystal] andywenk opened pull request #1475: change wording of 'var' to tulip in docs local_variables (gh-pages...change_wording_section_variables) http://git.io/vZHD5
fowlduck has quit [Ping timeout: 250 seconds]
<crystal-gh>
[crystal] jhass pushed 1 new commit to master: http://git.io/vZHSK
<crystal-gh>
crystal/master a398742 Jonne Haß: Contributing.md: fix typo and point out that docs/ is generated
<nakilon>
there is a Ukrainian box champion Klitchko that went to politics -- in one of interviews he said: "Today not everyone can look into tomorrow -- I mean not only everyone can look but also few of them who can"
<nakilon>
*very few
<jokke>
hmm
<jokke>
why can't i do this:
<jokke>
>> foo = Int32; 3.is_a?(foo)
<DeBot>
jokke: Syntax error in eval:4: expecting token 'CONST', not 'foo' - http://carc.in/#/r/fgv
<jhass>
because the compiler needs to understand it at compile time, is_a? actually just pretends to be a method
<jeromegn>
It'll be fun to figure out what's slow.
<jeromegn>
Also, I can't test exactly like the ruby implementation because of that bug I filed.
<jeromegn>
Would be more interesting to compare with the C lib too
<jokke>
what's the type grammar for a Proc where i don't care about the return type?
<jhass>
just leave it off
<jhass>
(Whatever ->)
<jokke>
ok
jeromegn_ has joined #crystal-lang
jeromegn has quit [Ping timeout: 252 seconds]
jeromegn_ is now known as jeromegn
ylluminate has quit [Ping timeout: 246 seconds]
<crystal-gh>
[crystal] jhass opened pull request #1477: Rename Channel related classes (master...rename_channel) http://git.io/vZQMv
ylluminate has joined #crystal-lang
ylluminate has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
<crystal-gh>
[crystal] jhass opened pull request #1478: Rename time related types (master...rename_time) http://git.io/vZQFn
<crystal-gh>
[crystal] asterite closed pull request #966: Change it to use postfix '_spec.cr' for spec files (master...spec-file-postfix) http://git.io/vqbcu
sadin has joined #crystal-lang
sadin has quit [Remote host closed the connection]
kostya has joined #crystal-lang
<crystal-gh>
[crystal] jhass opened pull request #1480: Rename a couple exceptions (master...rename_exceptions) http://git.io/vZQjo
sadin has joined #crystal-lang
BlaXpirit has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 3 new commits to master: http://git.io/vZ7v4
<crystal-gh>
crystal/master c0de252 Will Leinweber: add TypeCastError for runtime casting exceptions
<crystal-gh>
crystal/master c0de784 Will Leinweber: Add TypeCastError specs
<asterite>
Yes, could be. I think FileDescriptorIO and Buffered won't be used (often) in public APIs so it's ok to put them in the IO namespace
<asterite>
File will obviously remain File, and so does Socket, etc.
<jhass>
yeah sure
<jhass>
the last thing I see would be PointerIO -> Pointer::IO and PointerAppender -> Pointer::Appender but I'm even less sure about these compared to FileDescriptorIO / BufferedIO
<jhass>
mmh, I guess if we'd do Pointer::IO we would need to do String::IO
<jokke>
jhass: is it possible to store block arguments and call them later from some other method?
<jhass>
yes, but likewise finicky as dealing with Proc's (since they turn into Proc's)
<jhass>
but much like Ruby, &block in a method definition, you just have to add the type restriction or else (->) is assumed
havenwood has joined #crystal-lang
<jokke>
aaah
<jokke>
ok
<jokke>
hmm
<jokke>
damn
<crystal-gh>
[crystal] waj pushed 2 new commits to master: http://git.io/vZ72w
<crystal-gh>
crystal/master 92cbeaa Jonne Haß: Correctly handle signal exits in crystal run and add convenience methods...
<crystal-gh>
crystal/master 845f6d2 Juan Wajnerman: Merge pull request #1469 from jhass/fix_run_signal_handling...
<jokke>
jhass: so something like @block = block as Proc(Foo, Bar) ?
<jhass>
huh, no
<jhass>
def foo(&block : Foo -> Bar)
<crystal-gh>
[crystal] jhass opened pull request #1483: Rename IO related classes (master...rename_io) http://git.io/vZ7oh
<oleh>
hi everyone. What is analogue of lisp-like macroexpand in Crystal?
* jhass
doesn't know lisp
dleedev has quit [Quit: dleedev]
fowlduck has joined #crystal-lang
<jeromegn>
apparently StringIO.new is more expensive than string_io.clear
<oleh>
okey, how can I see what the code is generated by macro, that is how I can expand macro?
<jhass>
oleh: adding {{debug()}} to a macro prints the expansion to stdout up to the point of the call
<jhass>
besides that there's crystal browser which shows some of the expansions (those that are included inside methods or generate them)
<oleh>
jhass: thanks a lot
jeromegn_ has joined #crystal-lang
jeromegn has quit [Ping timeout: 268 seconds]
jeromegn_ is now known as jeromegn
<oleh>
actually, I need to see the code generated by macro call, and I can do it by `puts` method
<jhass>
no you can't do it "by puts"
<jhass>
putting {{debug()}} at the end is the only way for now
<oleh>
but I did it right now, example: puts record SomeRec, a, b. It gives error, but prints the code generated by macro call, and that is what I need.
<jhass>
ah well I guess so
<jhass>
but foo instead of puts would work too ;)
havenwood has joined #crystal-lang
<oleh>
yep, it's true ;)
<oleh>
but, for now I can't see another way to do that.
<jokke>
jhass: at which point are macro arguments evaluated?
<jhass>
evaluated?
<jokke>
hm i think i need {{yield}}
<Netfeed>
trying to run the specs for for http, but it can't link with crypto and ssl, and i've installed the libevent-openssl-2.0-5 package, not sure which is needed for crypto, but all in the list in the wiki should be installed
<BlaXpirit>
what's the approach to this? i thought about Hash(AssociatedObject, <closure data>)
<jhass>
BlaXpirit: well if you can identify a registered callback from the callback that could work, store the Proc and have a global callback that dispatches to the registered procs
<jhass>
Netfeed: libssl-dev you mean I hope
<BlaXpirit>
i think the callback is uniquely tied to an object, and that object is passed to the callback
<jhass>
yeah then you could store the actual object inside it I think
<jhass>
and actual callback
<BlaXpirit>
so Hash(AssociatedObject, <closure data>) like i said, or do you mean something else, because i don't udnerstand what you're sayin
<Netfeed>
jhass: libssl-dev was a part of it, probably only needed that package :)
<BlaXpirit>
closure data would be Box like you showed
<jhass>
BlaXpirit: more like have ->(container : CallbackContainer) { container.call }
elia has quit [Quit: Computer has gone to sleep.]
<jhass>
and have CallbackContainer store the user Proc and any data you need
<BlaXpirit>
so I was thinking Hash(Body, Box(Proc))
<BlaXpirit>
and that hash would have to be global
<jhass>
so you can't store some void pointer or something in Body?
<BlaXpirit>
I don't think so
<jhass>
well yeah then that way
<BlaXpirit>
oh look body_set_user_data
<jhass>
that looks better
<BlaXpirit>
but then what if i need to store something else in it?
<BlaXpirit>
if I want to associate some other custom data with that Body
<Netfeed>
a git question, i tried to rebase up my cookie branch to master so i can continue working on it, but there where some changes that diverged when i did the pull afterwards and a i got a merge in too, is there a way to remove that one? amend it in to my original commit?
<BlaXpirit>
...implement a struct that contains the procs and then whatever else i mean
<BlaXpirit>
i need*
<jhass>
yup
<BlaXpirit>
thanks
<jhass>
record CallbackData, callback, foo, bar, baz
<jhass>
Netfeed: a rebase usually throws out merge commits automatically
<jhass>
Netfeed: so what's your state now? In a rebase and conflicting?
<Netfeed>
my state now is that i have my first commit and then i have the merge commit commited
<Netfeed>
i'm not sure what would happen if i push this now
<jhass>
Netfeed: what's your remotes? origin your fork and upstream manastech/crystal ?
<Netfeed>
yes
<jhass>
git fetch upstream; git rebase upstream/master
<Netfeed>
alright, i've done that already once, and now i got to thinks the same stuff a third time it seems
<Netfeed>
maybe it sticks this time then
<jhass>
be less vague maybe?
<jhass>
if you get conflicts run git mergetool and if everything is resolved and marked as such git rebase --continue
<Netfeed>
alright, so i did the rebase first, fixed the problems i got. then it said that i was 400-something commits behind so i did the pull, then i got the to do some fixes and got the merge commit, and now i'm rebasing against master again
<Netfeed>
and now the merge commit is gone, nice, thanks
<jhass>
okay your mistake was to not git fetch upstream before the first rebase
<jhass>
I guess
<Netfeed>
maybe
<jhass>
the rule of thumb is to never rebase and always pull in integration branches (like master) and never pull, just fetch and rebase in feature/topic branches
<Netfeed>
okey, so now it says "Your branch and 'origin/http_cookie' have diverged, and have 423 and 1 different commit each, respectively. (use "git pull" to merge the remote branch into yours)"
<Netfeed>
sigh
<jhass>
Netfeed: don't pull, force push
<jhass>
rebase creates new commits, having to force push is expected
<jhass>
and that's also why you should never use it in integration branchs
<Netfeed>
i shouldn't have rebased?
<jhass>
no, yours is a topic/feature branch
<jhass>
that's perfectly fine to rebase (and I actually prefer that workflow)
<jhass>
Netfeed: looking good
<Netfeed>
alright, that seems better
<Netfeed>
now i just have to fix the stuff i need to fix :)
<jhass>
Netfeed: btw you can edit your last commit with git commit --amend, as that edits it it effectively creates a new one and you have to force push too if you pushed it before
apt-get has joined #crystal-lang
<Netfeed>
yeah, you thought me that last time i did this :)
<jhass>
sorry such things don't even go into my short term memory, it's flushed next day :P
<jhass>
of course the "best" way is to not have a union in the first place :P
<jhass>
Netfeed: when will you add context to your question?
<Netfeed>
never!
<Netfeed>
:)
<Netfeed>
https://gist.github.com/netfeed/78389deddaae8d35313d <-- i'm trying to do that again, i think it worked fine the last time, but now i get an error that @cookies isn't set in an initializer so it can be nil
<jhass>
well, it's true
<Netfeed>
yes, i'm not disputing that
<jhass>
I think this should be @cookies ||= Cookies.from_headers(headers) now
<jhass>
and from_headers should return an empty Cookies for when there's none
<Netfeed>
i think it does that as it does a new.tap inside from_headers
<jhass>
yeah probably
oleh has quit [Quit: leaving]
<Netfeed>
it works if i add @cookies = Cookies.new to the initializers, but i'm not sure if that's actually what they want
<Netfeed>
"they", asterite and waj
<jhass>
it isn't
<jhass>
def cookies; @cookies ||= Cookies.from_headers(headers); end; should work
<Netfeed>
huh, nice, it did
<Netfeed>
is that something that's new since the last month back?
<jhass>
nope
<Netfeed>
strange, because i think the patch i had in the gist actually worked when i created it
<Netfeed>
maybe that case has stopped working
<jhass>
doubt it did tbh
<Netfeed>
alright, amended
Neverdie has joined #crystal-lang
dfockler has quit [Remote host closed the connection]
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jeromegn>
feel bad to add a macro like that to a lib
<jeromegn>
that's going to be included elsewhere
<jhass>
true
<jhass>
it was more for fun anyway :P
<jhass>
you never detailed your usecase but it sure sounds fishy ;)
<jeromegn>
haha
<jeromegn>
all my work is fishy!
<jeromegn>
hmm
<jeromegn>
I wanted to write a generic BSON::Value module which would be included in the various classes that are supported by BSON
<jhass>
afraid I'm not making the connection
<jeromegn>
that module would have a generic to_bson. all the classes have to define is a bson_parts method which return an array of all the parts that should be appended as bytes to the BSON
<jeromegn>
it might have extraneous stuff, but that's a quick copy paste of the working pieces
dleedev has joined #crystal-lang
<jeromegn>
right now I've manually defined to_bson and bson_size, etc. in all my classes and structs extensions.
<jeromegn>
I figured I'd refactor and also serialize to bytes (via a Slice(UInt8)) by default
<jeromegn>
I'd love your input
<jhass>
they have strings with a size header and null terminated?
<jhass>
kinda silly
<jeromegn>
haha
<jeromegn>
yea
<jeromegn>
the strings are like that
<jeromegn>
everything else isn't
<jeromegn>
well
<jeromegn>
that's not true
<jeromegn>
but yea, null terminated + size is probably overkill, but that's what the spec describes.
<jeromegn>
any idea how I can make all of that nice?
<jhass>
I'm thinking
<jeromegn>
basically I want to produce "bson bytes" that I can just push onto an IO
<jeromegn>
probably easier to just use a regular Array instead of a Slice for stuff
<jhass>
btw I see many arrays in your (at least current) code that want to be tuples
<jeromegn>
what's the advantage? :)
<jhass>
arrays are heap allocated
<jhass>
tuples are for most cases basically gone after compile time
<jeromegn>
that's nice
<jeromegn>
remember me from a few months ago? I know near to nothing about the compiled world, but I love to learn :) your help is invaluable as always
<jhass>
tbh I think I'd mostly keep your current way
<jhass>
I don't see a lot of repetition
<jhass>
you'd just move the logic from to_bson to bson_parts
<jeromegn>
so, what arrays should I switch to tuples?
<jeromegn>
a few examples would help :)
<jeromegn>
also, using Slice == good idea?
<jhass>
yeah
<jhass>
hrm, looks like we need to add Tuple#reverse, but then the Int ones for example
<jhass>
>> {1, 2, 3}.reverse
<DeBot>
jhass: Error in line 4: undefined method 'reverse' for {Int32, Int32, Int32} - http://carc.in/#/r/fka
<jhass>
yeah
<jhass>
that should be fun, gimme 5 minutes
<jeromegn>
:)
<jeromegn>
well
<jeromegn>
technically, it should always be little_endian