Ven has quit [Read error: Connection reset by peer]
datanoise has joined #crystal-lang
BlaXpirit has joined #crystal-lang
datanoise has quit [Ping timeout: 264 seconds]
Cidan is now known as zz_Cidan
zipR4ND has joined #crystal-lang
BlaXpirit has quit [Quit: Quit Konversation]
BlaXpirit has joined #crystal-lang
zipR4ND has quit [Ping timeout: 276 seconds]
izzol has quit [Read error: Connection reset by peer]
fowlduck has quit [Read error: Connection reset by peer]
fowlduck has joined #crystal-lang
BlaXpirit has quit [Read error: Connection reset by peer]
BlaXpirit has joined #crystal-lang
datanoise has joined #crystal-lang
datanoise has quit [Ping timeout: 258 seconds]
zz_Cidan is now known as Cidan
havenwood has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
Ven has joined #crystal-lang
waj has joined #crystal-lang
Ven has quit [Ping timeout: 245 seconds]
Ven has joined #crystal-lang
BlaXpirit has quit [Read error: Connection reset by peer]
BlaXpirit has joined #crystal-lang
Ven has quit [Ping timeout: 265 seconds]
waj has quit [Quit: waj]
mdz_ has joined #crystal-lang
datanoise has joined #crystal-lang
jtarchie has joined #crystal-lang
datanoise has quit [Ping timeout: 265 seconds]
leafybasil has joined #crystal-lang
waj has joined #crystal-lang
thor77 has joined #crystal-lang
Benoist has joined #crystal-lang
BlaXpirit has quit [Quit: Quit Konversation]
bcardiff has joined #crystal-lang
vikaton has joined #crystal-lang
<thor77>
hey, i'm just trying to learn some crystal... just ran into a problem: i want to build a json-string from a Hash: https://gist.github.com/Thor77/da43b38e1be7512cb582 but the compiler says 'json_array' is not defined for JSON::Builder:Class
BlaXpirit has joined #crystal-lang
asterite has joined #crystal-lang
<asterite>
Hi thor77. What's a json-string from a Hash?
<asterite>
My confusion is that you say "I want to generate a hash with key value" but I don't know what's your source
zipR4ND has joined #crystal-lang
<thor77>
yeah, that looks fine
<thor77>
was looking for smth like that
<asterite>
Cool :)
<thor77>
thanks :)
<asterite>
:)
<thor77>
uhm, that means... most modules just add some methods to existing types?
<thor77>
never saw smth like that in other languages
<asterite>
In Ruby it's like that too. But it's not done that much. Here it's the standard library so you can think of that as if it comes with the language
<asterite>
There probably won't be any other JSON library other than the standard one because it's pretty good and also super fast, so adding `json_object` to IO is probably fine because nobody would need to define something like that
strcmp1 has quit [Remote host closed the connection]
<DeBot>
jhass: JSON::ParseException: expected string but was begin_object at 1:10 - more at http://carc.in/#/r/2xc
asterite has joined #crystal-lang
<asterite>
jhass: yes, it's because we made it possible to call a method on a union type as long as all types respond to it, but you only get the first one
<jhass>
in ./bxctl.cr:12: undefined method 'each_with_object' for Hash(String, JSON::Type)
<asterite>
Ah, Hash is not Enumerable in our case
<jhass>
ah, :/
<jhass>
I guess because we don't have autosplatting tuples (yet)
<jhass>
anyway, I still don't get the with_object returning iterator usecase
asterite has quit [Ping timeout: 246 seconds]
BlaXpirit has joined #crystal-lang
asterite has joined #crystal-lang
<asterite>
jhass: me neither, I added it to parallel with_index, but it's probably not very useful
<asterite>
We can remove it
<asterite>
We can also add Hash#each_with_object until we have autosplatting of tuples
<asterite>
if we ever do that
<jhass>
I'm biased regarding the autosplat, I know it's hated by many rubyists as too subtle behavior
<jhass>
but I can see clear usecases, in crystal even more than in Ruby
<jhass>
though actually tuple destructuring in block args etc would be even better I guess
<jhass>
each_with_object(foo) do |(key, value), foo|
mdz_ has joined #crystal-lang
<asterite>
jhass: yes, that's another alternative I've been considering
<asterite>
we'll probably need do |(*args)|
<asterite>
and yield *args
<asterite>
so we can make Hash be Enumerable... maybe
<jhass>
mmh
<jhass>
can we do overload matching on block args?
<jhass>
so we can have def each; yield k, v; end; end def each; yield {k, v}; end; ?
<jhass>
the former for the user the latter for enumerable ?
asterite has quit [Ping timeout: 246 seconds]
leafybas_ has joined #crystal-lang
shaderslayer is now known as shadeslayer
leafybasil has quit [Ping timeout: 252 seconds]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
unshadow has joined #crystal-lang
<unshadow>
datanoise: Sent you a PR for openssl.cr
<unshadow>
check it out ;)
<datanoise>
unshadow: will do. when do_handshake and renegotiate are useful?
zipR4ND has quit [Ping timeout: 265 seconds]
<unshadow>
datanoise: when you want to enforce a renegotiation on the server, lets say you suspect a malformed connection, or a MITM attacks, and you dont want to give people the opurtinty to crack the session key (like POODLE,CRIME,etc..) , you can set your client to do a renegotiation every 10 min, 20 min or 5 min etc..
<datanoise>
unshadow: i see
<unshadow>
f**k my English is terribly :(
<tkrajcar>
unshadow: i understood you perfectly :)
<tkrajcar>
"opportunity" not "opurtinty" though :D
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 244 seconds]
waj_ is now known as waj
aguynamedryan has joined #crystal-lang
bhishma has joined #crystal-lang
flaviu has quit [Read error: Connection reset by peer]
sandelius has joined #crystal-lang
waj_ has joined #crystal-lang
waj_ has quit [Remote host closed the connection]
waj has quit [Ping timeout: 258 seconds]
NeverDie has joined #crystal-lang
Cidan is now known as zz_Cidan
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
leafybasil has joined #crystal-lang
leafybas_ has quit [Ping timeout: 256 seconds]
leafybasil has quit [Ping timeout: 258 seconds]
mdz_ has quit [Remote host closed the connection]
mdz_ has joined #crystal-lang
zz_Cidan is now known as Cidan
sandelius has joined #crystal-lang
mdz_ has quit [Ping timeout: 252 seconds]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
<vikaton>
asterite, when will that video be public ?
mdz_ has joined #crystal-lang
<jhass>
yesterday :p
NeverDie has joined #crystal-lang
* vikaton
cries
<vikaton>
jhass, do u know haskell ?
<jhass>
no
bhishma has quit [Ping timeout: 256 seconds]
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
shama has joined #crystal-lang
<jiriki->
hmh
<jiriki->
are there any real-world applications made in crystal btw?
<jhass>
real world is a vague term
<vikaton>
jiriki-: Crystal itself
<jiriki->
hmh okay
<jhass>
that was meant as "what do you mean by real world"
leafybasil has joined #crystal-lang
datanoise has quit [Ping timeout: 276 seconds]
datanoise has joined #crystal-lang
aguynamedryan has quit [Quit: aguynamedryan]
miah has quit [Ping timeout: 276 seconds]
bcardiff1 has joined #crystal-lang
miah has joined #crystal-lang
bcardiff has quit [Ping timeout: 272 seconds]
havenwood has quit [Ping timeout: 265 seconds]
Benoist has joined #crystal-lang
havenwood has joined #crystal-lang
<Benoist>
can anyone help me out generating strings from bytes. From ruby I can do puts nil.to_msgpack which returns 0xC0. How can I write 0xC0 to a string in crystal so I the string lexer I'm creating can read it from the string or IO?
<Benoist>
I'm asking so I can put it in the test case