jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.6 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
<kori> the language I know the most is Go
<kori> go is nice but it's missing a couple stuff
<jhass> mmh, I guess you don't have some fairly small Go program you could port for fun?
<kori> I actually do
<kori> a concurrent uploader
<kori> for this website
<jhass> doesn't sound too small :P
<kori> I wanted to implement support for more websites
<kori> but then I got lazy
<kori> jhass: it actually is
<kori> it only requires http, ssl, json...
<jhass> mmh
<kori> unless it isn't for crystal :P
<jhass> yeah, could actually be feasible already
<kori> https://github.com/kori/good this is probably too small
<kori> to be worth porting over
<kori> actually it might not be
<kori> it involves command line parsing
strcmp1 has quit [Quit: Leaving]
<jhass> heh yeah, chance to look at OptionParser ;)
<Kilo`byte> yay parsing ipv6 addresses is fun (tm)
<jhass> if the -w wouldn't be it just be puts ARGV[0]? || "good" though :P
<kori> hrmm
<kori> good might become my new hello world
* Kilo`byte is feeling like he is asking too many noob questions
<Kilo`byte> does String have a method to count the times a certain char is present
<jhass> no worries
<jhass> >> "foo".count('o')
<DeBot> jhass: # => 2 - http://carc.in/#/r/cc9
<Kilo`byte> bam
<kori> jhass: I'm getting index out of bounds
<kori> wouldn't it be something along the lines
<kori> of
<jhass> kori: missed the ? ?
<kori> oh hah
<jhass> [x] raises, [x]? returns nil
<kori> aaaand it's done
<kori> good
<Kilo`byte> now i just need to parse 1-4 hex digits into 2 UInt8s
<Kilo`byte> what'd be the best approach?
<kori> alright... uhhh
<jhass> >> "ab".to_u8(16)
<DeBot> jhass: # => 171 - http://carc.in/#/r/cca
<Kilo`byte> >> "abcd".to_u8(16)
<DeBot> Kilo`byte: ArgumentError: invalid UInt8: abcd - more at http://carc.in/#/r/ccb
<Kilo`byte> thats the problem :P
<jhass> hardest part is to find some efficient slicing for the string I guess
<Kilo`byte> yeah
<jhass> >> "abdef".split(/(?<=..)/).map &.to_u8(16)
<DeBot> jhass: # => [171, 13, 14, 15] - http://carc.in/#/r/ccc
<Kilo`byte> i could use an u16 and then do some modulo on it
<jhass> eh, nope
<jhass> mmh
<jhass> that's probably the fastest way actually
<jhass> just shift & mask
<jhass> >> u = "abdef".to_u16(16); l &= 0xFF; u >>= 8; {u, l}
<DeBot> jhass: Syntax error in eval:4: '&=' before definition of 'l' - http://carc.in/#/r/ccd
<jhass> >> u = "abdef".to_u16(16); l = u & 0xFF; u >>= 8; {u, l}
<DeBot> jhass: ArgumentError: invalid UInt16: abdef - more at http://carc.in/#/r/cce
<jhass> uh
<jhass> >> u = "abcd".to_u16(16); l = u & 0xFF; u >>= 8; {u, l}
<DeBot> jhass: # => {171, 205} - http://carc.in/#/r/ccf
<jhass> is that right? I suck at those :D
<jhass> >> "cd".to_u8(16)
<DeBot> jhass: # => 205 - http://carc.in/#/r/ccg
<Kilo`byte> jhass: that looks like a good approach though
<jhass> keeps them as UInt16's though
<Kilo`byte> nothing a .to_u8 won't fix
<Kilo`byte> :P
<jhass> >> u = "abcd".to_u16(16); l = u & 0xFF; u >>= 8; {u.to_u8, l.to_u8} # and hope LLVM is smart about it
<DeBot> jhass: # => {171, 205} - http://carc.in/#/r/cch
<kori> FIRST PROJECT IN CRYSTAL, DONE
<jhass> congratz :D
<kori> heh
<jhass> btw we kinda inherited two spaces for indentation from ruby, just in case you seek contributors at something more elaborate ;P
<kori> I see
<kori> alright
<kori> :P
<jhass> <3
<jhass> that module is maybe a bit pointless, but who cares^^
<kori> ┐('~'; )┌
<kori> I don't understand the language yet
<jhass> no worries
<kori> it's not required for this kind of program, right?
<kori> just so I know
<kori> gotta make it ultra-minimalist
<jhass> right
<kori> jhass: wanna know the funniest part? something similar happened with good
<kori> just keeping in line :P
<kori> then again, the market for GNU yes replacements isn't that large...
<jhass> module serves two and a half purposes: 1) as a namespace for other constants (which modules and classes two kind of are) module Foo; class Bar; end; end; Foo::Bar 2) as mixins; module Foo; def foo; end; end; class Bar; include Foo; end; Bar.new.foo 2.5) as holders for utility "class methods", module Foo; def self.foo; end; end; Foo.foo,
<kori> I see
<kori> I haven't dabbled with OOP
<kori> but I guess I'll have to now
<kori> I thought it was somewhat similar to Go's package declaration
wmoxam has quit [Ping timeout: 260 seconds]
<kori> ...but then I realized: I haven't defined any functions anyway
<jhass> and of course you can combine all of these in one module if you really want
<jhass> namespace is probably the most common usecase actually
<jhass> since there's only one global one shared across all files
wmoxam has joined #crystal-lang
<kori> just curious, have you used go?
<jhass> you usually keep all your my_library's stuff inside a module MyLibrary
<jhass> nope
<jhass> my strongest language is Ruby
<kori> the package declaration is kind of a namespace
<kori> for example, package "fmt" has a function named Println
<kori> when you import it
<kori> you call it as fmt.Println
<jhass> yeah, though I guess it has closer to python style imports? you can eg. rename?
<kori> uhhh
<kori> import foo as bar?
<kori> for example?
<jhass> yeah
<kori> you can kinda
<kori> it's import ( bar "foo" )
<jhass> so Crystal's loading system is file based
<jhass> require takes filenames and those just happen to define some module by convention. Or they don't, end-user issue
<kori> so it's kinda similar to go?
<jhass> I really haven't touched go yet :/
<kori> jhass: uhh 1sec
<kori> has an Upload method
<kori> go source code is organized like that, files beling to a certain package in a dir
<kori> named after the package
<kori> I could have another foo.go file there
<kori> that would be in package teknik
<kori> and it'd get imported
<kori> there
<jhass> yup, and the filename has to match the package declaration, right?
<kori> it doesn't have to, I think
<kori> but it usually does :P
<jhass> mmh, so I can say for sure that in Crytal it doesn't, of course it's sane convention that it does
<kori> well
<kori> I don't know for certain how it works in go
<kori> but there's a go path
<Kilo`byte> in a spec, how do i ensure the class of a value is correct?
<kori> and then packages are searched for there
<kori> so you import "fmt"
<kori> not import "/some/path/fmt"
<Kilo`byte> stuff.class.should be(WhateverClass) prodices a compile error
<jhass> sure, the question is if import "fmt" could make the package blawub available
<kori> it couldn't
<kori> I think crystal should import modules, not directories
<kori> by default
<kori> s/import/load/
<jhass> it loads files really
<Kilo`byte> yeah
<Kilo`byte> like ruby
<kori> well yeah
<kori> I'm really not sure how things are working here
<jhass> in practice conventions like http://guides.rubygems.org/name-your-gem/ will develop
<kori> hmm how about this
<jhass> >> require "spec"; "foo".class.should be(String)
<DeBot> jhass: in /usr/lib/crystal/spec/expectations.cr:28: undefined method 'same?' for String:Class - http://carc.in/#/r/cci
<kori> do I need to specify a relative/absolute path when loading modules, or is there some environment variable which will let me load a module just by its name?
<jhass> >> require "spec"; "foo".class.should eq(String)
<DeBot> jhass: # => nil - more at http://carc.in/#/r/ccj
<Kilo`byte> wat
<Kilo`byte> sec
<kori> something like
<kori> uhhh
<kori> well
<jhass> kori: require "foo"; will search CRYSTAL_PATH (or the baked in value from CRYSTAL_CONFIG_PATH if unset) for "foo.cr" and "foo/foo.cr"
<kori> hmmm
<kori> that might be what I want then, yeah
<jhass> require "foo/bar" will search it for "foo/bar.cr" and "foo/bar/bar.cr"
<kori> cool cool
<kori> and then when foo.cr file is loaded
<jhass> yep
<kori> the contents, being in module "foo"
<Kilo`byte> require "spec"; class MyClass; end; (MyClass.new as MyClass|String).should be(MyClass)
<Kilo`byte> >> require "spec"; class MyClass; end; (MyClass.new as MyClass|String).should be(MyClass)
<DeBot> Kilo`byte: in /usr/lib/crystal/spec/expectations.cr:28: no overload matches 'String#same?' with types MyClass:Class - http://carc.in/#/r/cck
<kori> I can call foo.Bar
<kori> right?
<kori> (bar being a function in module foo)
<jhass> right, module names have to start with an uppercase letter though and by convention should use CamelCase
<kori> ah I see
<Kilo`byte> jhass: thats where my issue happens :P
<jhass> just like class names
<Kilo`byte> so it'd be Foo.bar
<Kilo`byte> :P
<kori> this is going to be pretty weird to get used to
<jhass> >> require "spec"; class MyClass; end; (MyClass.new as MyClass|String).class.should eq(MyClass)
<DeBot> jhass: # => nil - more at http://carc.in/#/r/ccl
<kori> since I'm used to foo.Bar, not Foo.bar
<Kilo`byte> function names are by convention snake_case
<Kilo`byte> same for variables
<kori> oh
<Kilo`byte> in fact, local variables MUST be lowercase or they are treated as class constants
<Kilo`byte> (at least first char)
<kori> crystal is still in alpha, I'll pretend that convention doesn't exist and some day it'll go away
<kori> just kidding :P
<Kilo`byte> jhass: right i have a .class there in my code though
<jhass> >> require "spec"; class MyClass; end; (MyClass.new as MyClass|String).is_a?(MyClass).should be_true
<DeBot> jhass: # => nil - more at http://carc.in/#/r/ccm
<jhass> perhaps better
<jhass> Kilo`byte: note how I swapped your be with eq
<Kilo`byte> ohh
<jhass> oh, actually
<jhass> >> require "spec"; class MyClass; end; (MyClass.new as MyClass|String).should be_a(MyClass) # Kilo`byte use this
<DeBot> jhass: # => nil - more at http://carc.in/#/r/ccn
<kori> alright cool
<Kilo`byte> hmm nice
<kori> hrmm
<kori> jhass: thanks for all the help so far, by the way
<jhass> yw
<kori> also, if I want to refer to some pack-, er, module's documentation, what should I do?
<kori> go has godoc <module> <function>
<kori> ... <package>
<kori> grrr
<kori> as in, godoc fmt Println would give me information on how to use fmt.Println, alongside the type signature
<kori> like this
<Kilo`byte> kori: thing is: most functions do not even include typeinfo in their definition
<Kilo`byte> also, test state on ip parsing: .FFF..F..
<kori> Kilo`byte: oh
<jhass> kori: for stdlib, just hit crystal-lang.org/api
<kori> awesome
<jhass> there's a site that parses github repos, let me find it
<kori> alright this is pretty great
<jhass> and if you have something locally you can run crystal doc
<jhass> that'll parse src/ iirc
<kori> cool
<kori> well hrmm I don't know what else to do
<kori> ...actually I just forgot I have an IDEAS folder
<kori> s/forgot/remembered/
<jhass> in doubt you can always read through stdlib until you find an undocumented method (well, that shouldn't take long :P), try to understand it and write docs for it :P
<Kilo`byte> jhass: wait, count does not support counting occurances of strings in another string?
<Kilo`byte> that one got me
<Kilo`byte> luckily there are unit tests
<jhass> >> "foo".count("fo")
<DeBot> jhass: # => 3 - http://carc.in/#/r/ccq
<jhass> ah right, it's String#count syntax :D
<Kilo`byte> it takes the string as a set
<jhass> yeah, like Ruby
<Kilo`byte> this broke my error check logic D:
<jhass> I actually wrote Crystals String#count -.-
<jhass> I don't think my set parsing is fully complete yet though
<Kilo`byte> jhass: i think .count_string might be useful
<kori> jhass: on a scale of 1 to 20, how much would you recommend me using your IRC library?
<Kilo`byte> for now i'll go with a regex
<kori> from DeBot
<jhass> it's written against 0.6 still, soo, more like 2-3 :/
<kori> hrm
<jhass> https://github.com/Thor77/crystal_irc is written against 0.7 at least
<kori> I don't know if I have the skill to write my own
<Kilo`byte> expected: "10:0:0:0:0:0:0:0"
<Kilo`byte> got: "0:10:0:0:0:0:0:0:0:0:0:0:0:0:0:0"
<Kilo`byte> that looks like i derped something
<Kilo`byte> xD
<Kilo`byte> oright...
<kori> I have never used ruby, but from what I've heard, cinch is pretty neat
kyrylo has quit [Ping timeout: 260 seconds]
<Kilo`byte> it is
<Kilo`byte> have used it myself multiple times
<Kilo`byte> ((@data[i * 2].to_u16 << 8) & @data[i * 2 + 1].to_u16).to_s(16)
<Kilo`byte> that line isn't working as expected, where is my mistake?
<Kilo`byte> any ideas?
<Kilo`byte> @data is a Slice(UInt8)
<willl> i think you want | not &
<Kilo`byte> err yes
<Kilo`byte> of course
<Kilo`byte> 9 examples, 0 failures, 0 errors, 0 pending
<Kilo`byte> yay
<Kilo`byte> willl: regarding your performance concerns: its not as big of a concern here, as its not going to be called that often
<Kilo`byte> also the performance difference is practically nothing
<willl> i had those from when i was benchmarking something
<willl> but it shows a few different ways to do it. i settled on the handshift ones because both the 32 and 64 ended up looking similar
<willl> and llvm optimized them to be byteswap instructions anyway
<Kilo`byte> what i did however learn was the existance of Benchmark.ips
<Kilo`byte> thanks :P
<Kilo`byte> kori: also your skill concerns: i cobbled together a really simple irc lib thingy last night in rust
<Kilo`byte> the hardest part was the parsing code, i can give you that
NeverDie has joined #crystal-lang
<Kilo`byte> did i say rust
<Kilo`byte> i am getting _really_ tired
<Kilo`byte> crystal ofc
<jhass> oh, a third parser? :P
<Kilo`byte> it doesn't handle tags yet though :P
<kori> Kilo`byte: when I say "new" programmer
<jhass> tags?
<kori> I really mean it :P
<Kilo`byte> jhass: ircv3 feature
<kori> especially to OOP
<jhass> ah right, mine neither I guess :P
<Kilo`byte> example: @account=Kilobyte22 :Kilobyte!~kilobyte@cucumber.kilobyte22.de PRIVMSG #crystal-lang :test
<Kilo`byte> jhass: https://gist.github.com/Kilobyte22/a50a0149187090f294bd probably isn't most efficient
<kori> does crystal have map, filter and reduce
<kori> ?
<Kilo`byte> yes
<Kilo`byte> well, i think filter has a different name
<Kilo`byte> select works for sure
<jhass> map is .map {|i| ... }
<jhass> filter is .select {|i| ... } I guess
<Kilo`byte> sadly afaik they are not lazy
<jhass> and .reduce(optional_initial) {|accum, i| ... }
<kori> navigating the docs is kinda confusing
<kori> this
<Kilo`byte> kori: /api is there as well
<jhass> Kilo`byte: map and select have Iterator versions by now
<kori> Kilo`byte: aye
<kori> jhass: just wondering
<jhass> >> "foo".each_char
<Kilo`byte> jhass: yeah, but they are not default :P
<DeBot> jhass: # => #<String::CharIterator:0x910efc0 @reader=CharReader(@string="foo", @pos=0, @current_char='f', @current_char_width=1, @end=false), @end=false> - http://carc.in/#/r/ccv
<kori> is Iterator similar to Enumerable?
<Kilo`byte> oh they are?
<Kilo`byte> fancy
<jhass> >> "foo".each_char.map {|c| c.ord }
<DeBot> jhass: # => Iterator(T)::Map(String::CharIterator, Char, Int32)(@iterator=#<String::CharIterator:0x8eedfc0 @reader=CharReader(@string="foo", @pos=0, @current_char='f', @current_char_width=1, @end=false), @end=false>, @func=#<(Char -> Int32):0x8050380>) - http://carc.in/#/r/ccw
<jhass> >> "foo".each_char.map {|c| c.ord }.to_a
<DeBot> jhass: # => [102, 111, 111] - http://carc.in/#/r/ccy
<Kilo`byte> "foo bar".each_char.map {|c| c.ord }.take(2).to_a
<Kilo`byte> >> "foo bar".each_char.map {|c| c.ord }.take(2).to_a
<DeBot> Kilo`byte: # => [102, 111] - http://carc.in/#/r/ccz
<Kilo`byte> \o/
<jhass> kori: not quite, they expose similar API but Enumerable is a module that gives you a bunch of functionality based on your .each method
<jhass> while Iterator is for lazy iteration
<Kilo`byte> now... can you create infinite iterators?
<kori> I know how rust iterators work
<kori> kinda
<kori> hrmmm
<Kilo`byte> or is there no api for that yet
<kori> oh whatever I won't compare languages
<Kilo`byte> like, it'd work in theory
<kori> but yeah some better documentation is needed
<jhass> Kilo`byte: most of them are structs, so pretty much
<Kilo`byte> kori: i keep comparing it to scala :P
<Kilo`byte> in my head at least
<jhass> oh you mean upto infinity
<Kilo`byte> yeah
<jhass> >> 1.upto(Float::INFINITY)
<DeBot> jhass: Error in line 4: undefined constant Float::INFINITY - http://carc.in/#/r/cd0
<jhass> eh, we don't?
<kori> if I keep comparing crystal to anything I'll go mad
<kori> haha
<jhass> >> 1.upto(1/0.0)
<Kilo`byte> jhass: nono xD
<DeBot> jhass: # => #<Int::UptoIterator(Int32, Float64):0x9256f90 @from=1, @to=inf, @current=1> - http://carc.in/#/r/cd1
<Kilo`byte> wait
<Kilo`byte> that returns an iterator? :O
<jhass> >> 1.upto(1/0.0).take(20)
<DeBot> jhass: # => #<Iterator(T)::Take(Int::UptoIterator(Int32, Float64), Int32):0x9483f78 @iterator=#<Int::UptoIterator(Int32, Float64):0x9483f90 @from=1, @to=inf, @current=1>, @n=20, @original=20> - http://carc.in/#/r/cd2
<Kilo`byte> thats some interesting news
<jhass> >> 1.upto(1/0.0).take(20).to_a
<DeBot> jhass: # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] - http://carc.in/#/r/cd3
<jhass> Kilo`byte: if you don't pass a block
<Kilo`byte> yeah noticed that
<Kilo`byte> reminds me of a guy who used the rust macro facilities to implement a syntax element for recurrent sequences
<Kilo`byte> (i've yet to see a language with as powerful macro capabs *wink*)
<Kilo`byte> to be fair, crystal isn't THAT far off
<kori> Kilo`byte: any lisp?
<Kilo`byte> i've yet to look into lisp really
<jhass> Kilo`byte: http://carc.in/#/r/9ou how do you like my maybe macro? :P
<Kilo`byte> heh, thats pretty nice
<Kilo`byte> rust cannot do that without a compiler plugin :P
<Kilo`byte> jhass: the main thing rust macros can do that crystal ones can't is specifying the call syntax
<Kilo`byte> inside of the call brackets you can do basicly anything as long as there are no unmatched brackets
<jhass> you can do anything in crystal macros as long as the result parses to valid crystal expression
<jhass> I can get you your argument list from a shell script or whatever
<Kilo`byte> no, the call syntax
<Kilo`byte> stuff!(somevar -> sometype);
<jhass> oh, you mean the macro call, gotcha
<jhass> well, you could pass a string pass that to the run macro and do whatever :P
<Kilo`byte> well, thats boring ;)
<Kilo`byte> like, D has a recurrance function which does that
elbow_jason has quit [Ping timeout: 246 seconds]
<Kilo`byte> auto fib = recurrence!("a[n-1] + a[n-2]")(0, 1);
<jhass> but given you can pass any valid crystal expression to a macro it's good enough I guess
<Kilo`byte> in rust you can model that without string
<Kilo`byte> let fib = recurrence!(a[n]: u64 = 0, 1 ... a[n-1] + a[n-2]);
<jhass> thinking about it I'm not even sure if allowing to introduce arbitrary syntax is a good idea
<Kilo`byte> its just something to think about ;)
<jhass> if you limit to valid crystal syntax it looks more coherent and there's probably less to learn
<Kilo`byte> certainly would make things more flexible
<Kilo`byte> i do like how you can pass blocks to macros though :P
<Kilo`byte> thats a nice touch
NeverDie_ has joined #crystal-lang
NeverDie has quit [Ping timeout: 256 seconds]
elbow_jason has joined #crystal-lang
<Kilo`byte> jhass: btw, i did some irc lib benchmarking, however the one by Thor77 is really not looking like it fully implements the irc protocol
<jhass> interesting
<Kilo`byte> just out of curiousity, lets throw in a regex based one
<jhass> didn't think pcre performs that well
<jhass> oh, wait, I misremember
<jhass> well, it's 4am here, I should sleep a bit :D
<Kilo`byte> jhass: same here
<Kilo`byte> who needs sleep :P
<Kilo`byte> well, to be fair, i should get some sleep as well
elbow_jason has quit [Ping timeout: 260 seconds]
NeverDie has joined #crystal-lang
NeverDie_ has quit [Ping timeout: 240 seconds]
elbow_jason has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
elbow_jason has quit [Remote host closed the connection]
Sadin has joined #crystal-lang
Sadin has quit [Ping timeout: 244 seconds]
havenwood has joined #crystal-lang
kulelu88 has joined #crystal-lang
blue_deref has quit [Quit: bbn]
ryanf_ is now known as ryanf
sailorswift has joined #crystal-lang
sailorswift has quit [Max SendQ exceeded]
kulelu88 has left #crystal-lang ["Leaving"]
sailorswift has joined #crystal-lang
sailorswift has quit [Max SendQ exceeded]
sailorswift has joined #crystal-lang
sailorswift has quit [Ping timeout: 265 seconds]
sailorswift has joined #crystal-lang
sailorsw_ has joined #crystal-lang
sailors__ has joined #crystal-lang
sailorswift has quit [Ping timeout: 244 seconds]
sailorswift has joined #crystal-lang
sailorsw_ has quit [Read error: Connection reset by peer]
sailors__ has quit [Read error: Connection reset by peer]
sailorsw_ has joined #crystal-lang
sailorswift has quit [Ping timeout: 244 seconds]
tatey_ has quit []
sailorswift has joined #crystal-lang
sailorsw_ has quit [Ping timeout: 256 seconds]
havenwood has quit [Ping timeout: 246 seconds]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] bjmllr opened pull request #1262: several small improvements to Regex (master...regex) http://git.io/vswhD
sailorswift has joined #crystal-lang
BlaXpirit has joined #crystal-lang
sleeper_ is now known as sleeper
<thor77> Kilo`byte: no, my lib is far away from complete
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ssvb has quit [Ping timeout: 256 seconds]
ssvb has joined #crystal-lang
kyrylo has joined #crystal-lang
NeverDie has joined #crystal-lang
zamith has joined #crystal-lang
zamith has quit [Client Quit]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
<Kilo`byte> thor77: the code is pretty hard to understand though :P
<thor77> Kilo`byte: uh, sry :/
<thor77> i'm not that experienced in writing crystal-code
<Kilo`byte> also, does it support both messages with and without prefix? :P
<thor77> message-prefix?
<Kilo`byte> the irc format is :prefix command params :more params
<Kilo`byte> prefix, params and more params being optional
<Kilo`byte> yeah, i know
<Kilo`byte> i benchmarked it yesterday
<Kilo`byte> didn't apply unit testing to it though
<Kilo`byte> thor77: so whats the output? i'd expect for example a tuple {prefix: String|Nil, command: String, params: Array(String)}
<Kilo`byte> doesn't look like that to me :P
<thor77> https://github.com/Thor77/crystal_irc/blob/master/src/crystal_irc/connection.cr#L42 if i receive a message, i create a new Message-obj
<Kilo`byte> so i'd personally rate it as hacky parser that "works"
kyrylo has quit [Quit: Konversation terminated!]
<thor77> Message-obj.init calls the Message.parse-method
<thor77> and this parse-method fills the class with some information-attr
kyrylo has joined #crystal-lang
<thor77> type, data, host and target
<Kilo`byte> well yes, but it looks like it nowhere has an array or something of params
<Kilo`byte> which has me concerned, as messages can contain practically an unlimited amount of parameters
<thor77> maybe you can call the Message-obj an array of params
<thor77> s/params/data
<thor77> and msg.data includes everything
<Kilo`byte> lets say you have this message: SOMETHING param1 param2 param3 :param 4
<Kilo`byte> how'd that get parsed
<thor77> let's test it
<Kilo`byte> i'd expect {nil, "SOMETHING", ["param1", "param2", "param3", "param 4"]}
<Kilo`byte> or w/e representation
<Kilo`byte> my implementation stores it in a class as well
<thor77> type = "SOMETHING", host = "", target = "", data = "param1 param2 param3 :param 4"
<jhass> so no parameter parsing
<thor77> yeah
<Kilo`byte> yup
<jhass> what about :jhass@2001::dead:beef 331 * :foo
<Kilo`byte> jhass: you missed a jhass! there :P
<jhass> shit, yeah
<Kilo`byte> but w/e it proves the point
<Kilo`byte> also yeah, my first irc parser (which i wrote before reading the RFC) had issues with ipv6
<thor77> type = '331', host = 'jhass@2001::dead:beef', target = '*', data = 'foo'
<Kilo`byte> whats target about
<jhass> and why wasn't it in the previous one
<thor77> target is the recevier of the msg
<Kilo`byte> why'd you make that a seperate field
<thor77> why not?
<Kilo`byte> because its technically a regular parameter
<jhass> let's see
<jhass> 235 :foo: bar
<Kilo`byte> my parser would make that IRCLine{prefix: "jhass@2001::dead:beef", command: "331", params: ["*", "foo"]}
<thor77> type = '235', host = '', target = '', data = ':foo: bar'
<sardaukar> is it possible to do before_each on spec?
<sardaukar> I see theres a before_each, but it's not being used anywhere in the source
<jhass> thor77: :me!you@::1 235 :foo: bar then?
<jhass> sardaukar: no, spec doesn't support that. The before_each is global and meant for things like mocking libs
<Kilo`byte> thor77: does it also properly handle it if the last param doesn't start with a :
<sardaukar> bummer
<thor77> type = '235', host = 'me!you@::1', target = ':foo:', data = ''
<thor77> Kilo`byte: it doesn't care about different params
<jhass> thor77: where's the bar? I broke it :P
<Kilo`byte> like ":someone PRIVMSG #channel :foo" and ":someone PRIVMSG #channel foo" should yield exact same result
<thor77> Kilo`byte: it's just stupid string-splitting
<thor77> jhass: uh, yeah o.O
<thor77> oh
<thor77> no
<thor77> i didn't copy your complete message
<thor77> type = '235', host = 'me!you@::1', target = ':foo:', data = 'ar'
<thor77> but still weird output
<thor77> actually it DOES care about the :
<jhass> it should, while FOO :bar and FOO bar are the same, FOO :bar :baz and FOO bar baz are not
<Kilo`byte> yup
<thor77> i never really thought about this parsing-algorythm, it worked perfectly for me until now
<jhass> nobody in your channel does : highlights I guess :P
<jhass> someone FOO foo : bar, someone FOO foo :bar, someone FOO : foo : bar
<jhass> and so on
<thor77> i just remove the first character from @data, because i assume its the :
<Kilo`byte> it doesn't have to be a :
<Kilo`byte> well, the thing is: a parser that "works" will eventually break
<thor77> but on most irc-servers its a :
<Kilo`byte> and you'll have fun figuring it out, because its hard to notice
<jhass> in FOO :foo: bar there's only one param and its "foo: bar"
<Kilo`byte> always unit test a parser
<thor77> heh
<thor77> is your parser somewhere available on github?
<Kilo`byte> might actually contain bugs
<Kilo`byte> if you find something that breaks it i'll be happy to fix it
<thor77> license?
<Kilo`byte> MIT
<thor77> let's see if i can include your parser into my code
<thor77> or do you want to create a pull request? :P
<Kilo`byte> well, i wanna test it fully first
<Kilo`byte> and i will add tag support
<Kilo`byte> its about 50% slower than yours though
<Kilo`byte> but they are all so fast, it doesn't really make difference
<Kilo`byte> thing about that code
<Kilo`byte> i have actually not unit tested it
<thor77> okey. if you're finished testing, please create a pr :)
<Kilo`byte> only real-world testing
<Kilo`byte> jhass: in a hash, is nil a valid value or does that unset it
<jhass> it's a valid value
zamith has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
<Kilo`byte> >> {"a": "b"} == {"a": "b"}
<DeBot> Kilo`byte: # => true - http://carc.in/#/r/ceh
<Kilo`byte> :D
<Kilo`byte> >> {} of String => String == {} of String => String|Nil
<DeBot> Kilo`byte: # => true - http://carc.in/#/r/cej
<Kilo`byte> very nice
<jhass> Kilo`byte: String|Nil has a shortcut: String?
<Kilo`byte> i am aware :P
<Kilo`byte> but i personally tend to prefer |Nil
<RX14> i might make a crask at a IRC lib
<RX14> crack*
<RX14> i've done one in java before
<Kilo`byte> jhass: is the output order for Hash#each always same if i put same stuff into hash in same order?
<Kilo`byte> otherwise i need a way to change that so i can properly unittest serialization of tags
<jhass> mmh, I hope it has insertion order yeah, but I never checked
<jhass> Kilo`byte: https://github.com/manastech/crystal/blob/master/spec/std/hash_spec.cr#L344-L357 things like this suggest it's indeed insertion ordered
<BlaXpirit> O_O
<BlaXpirit> how can it be insertion ordered
<jhass> one singly linked list through all items
<jhass> oh, that's actually even doubly linked
<BlaXpirit> sounds like a horrible implementation
<BlaXpirit> wtf
<Kilo`byte> ....E.FFFFFF
<Kilo`byte> looks like my unit tests are broken
<RX14> so which crystal IRC lib has the most complete specs for me to nick?
<thor77> heh
* thor77 has no specs
* jhass neither :P
<thor77> but maybe you can get some inspiration
<thor77> https://github.com/Thor77/crystal_irc/blob/master/src/crystal_irc/connection.cr especially this class for connection-things
<BlaXpirit> no, i don't understand this Hash at all
<jhass> happens, if you have any questions just ask them
<Kilo`byte> RX14: i am writing specs for my parser atm
<Kilo`byte> can give you once done
<RX14> thanks
<Kilo`byte> it also tests ircv3 capabs. if your parser doesn't support that just remove the respective specs
<RX14> well i'll make it parse ircv2 before v3
<Kilo`byte> jhass: uh, aren't you maintaining the aur package?
<jhass> yeah
<Kilo`byte> could you maybe get it to use llvm35
<Kilo`byte> for debug symbols
<jhass> I'd rather like it to keep it on 35 tbh
<jhass> er, 36
<jhass> 37 is around the corner
<Kilo`byte> well without debug symbols its a pain to debug
<jhass> yeah, but we should rather patch crystal to generate the correct ones
<Kilo`byte> like, i have this stack thingy: *parse<String>:IRCParser::IRCLine +6 [139652844377784]
<Kilo`byte> i think its probably at the beginning somewhere (see the +6) but idk
<Kilo`byte> actually nvm
<jhass> I'd say get a copy of the repo that you build against 35 and then just alias crystal35="~/foo/bin/crystal"
<jhass> it's retaining that semantic, yes
<BlaXpirit> so is there really no additional cost in having this implementation with insertion order?
<jhass> semantic != implementation
<jhass> Crystal's hash implementation isn't as advanced
<Kilo`byte> 12 examples, 0 failures, 0 errors, 0 pending
<Kilo`byte> :D
<jhass> mmh, actually the implementation is similar
<jhass> BlaXpirit: the additional cost is two pointers per entry
<jhass> and a tail pointer
<BlaXpirit> how to benchmark memory?
<BlaXpirit> how much memory a data structure uses
<jhass> that's a good and tricky question
<Kilo`byte> including all pointers? tricky one
<BlaXpirit> surely the GC knows everything
<jhass> the easiest is probably to observe external RSS and have different implementations in distinct processes
<jhass> maybe disabling GC
<Kilo`byte> btw
<Kilo`byte> my favourite c++ define: #define delete
<Kilo`byte> awesome to troll ppl
<Kilo`byte> just slip it in their header file
<BlaXpirit> people don't use delete these days
<BlaXpirit> at least good c++ programmers
<jhass> Bjarne says every new and delete is probably a bug anyway ;)
<Kilo`byte> yeah, true
<Kilo`byte> but still, the odd place where they do
<BlaXpirit> anyway... for now i'll just benchmark python vs crystal Hash
<jhass> but you can troll much better in Ruby. class Object; def !; [true, false].sample; end; end;
<BlaXpirit> wondering what would be a good benchmark
<thor77> BlaXpirit: thats not fair^^
<BlaXpirit> why not?
<thor77> because crystal compiles to c
<BlaXpirit> uhh no..?
<Kilo`byte> nah
<thor77> python is just a scripting-lang
<Kilo`byte> it compiles to llvm bytecode
<BlaXpirit> i'll move on to ruby then
<thor77> s/compiles to c/compiles to a optimized executable
<Kilo`byte> ruby > python imo
<BlaXpirit> k
<Kilo`byte> we no need no stinkin' python
<BlaXpirit> k
<thor77> :O
<thor77> python <3
<Kilo`byte> my personal opinion is that python is a steaming piece of turd
<jhass> thor77: python's hash implementation is written in python itself?
<Kilo`byte> jhass: its called a dict because they want to feel special
<Kilo`byte> but i highly doubt it
<thor77> jhass: don't think so
<BlaXpirit> Kilo`byte, yeah, please tell me how great of a name Hash is
<jhass> whatever, map then
<BlaXpirit> please just stop this BS
<Kilo`byte> BlaXpirit: you can smoke hash
<BlaXpirit> you can suck dict
<BlaXpirit> wait..
<jhass> thor77: so, it's both native code then, no? ;)
<Kilo`byte> well, you can also smoke a dict, but the effect is probably not that great
<thor77> uhm, you're right
* thor77 still loves python
<thor77> especially the syntax
<Kilo`byte> thats the worst part imo
<Kilo`byte> directly followed by the standard api
<thor77> ruby-syntax is very confusing to me
<Kilo`byte> its an oop language
<thor77> oop <3
<Kilo`byte> yet to_string or w/e isn't a method for all classes
<Kilo`byte> but instead you use string(stuff)
<thor77> yeah
<Kilo`byte> actually str()
<Kilo`byte> thats just completely unexpected
<thor77> it's not
<BlaXpirit> Kilo`byte, get out. nobody was arguing the merits of any language
<BlaXpirit> then you just come in saying python sucks
<Kilo`byte> BlaXpirit: sorry, just telling my opinion :P will stop now
<thor77> at least we all agree php sucks? :P
<Kilo`byte> was just that a python fanboy was realling pissing me off the other day
<Kilo`byte> thor77: i hope we do
<Kilo`byte> got a nice link for that :P http://phpmanualmasterpieces.tumblr.com/
<Kilo`byte> rofl
<RX14> how do you pass by reference?
<BlaXpirit> RX14, everything is passed by reference
<BlaXpirit> (except for values and structs)
<RX14> oh...
<RX14> yeah i knew objects are references
<RX14> umm
<RX14> never mind
<RX14> but passing an int by reference?
<RX14> how do you reference a value type
<BlaXpirit> RX14, that's against the language's idioms
<BlaXpirit> you can make pointerof(that_int)
<RX14> ugh so you can't pass an int out
<BlaXpirit> i don't know otherwise
<RX14> yeah i guessed pointers could
<BlaXpirit> RX14, what do you actually want to do?
<RX14> the way you return 2 values from a method constructs an array right?
<RX14> that's overhead
<BlaXpirit> RX14, no
havenwood has joined #crystal-lang
<BlaXpirit> you return a tuple
<BlaXpirit> barely any overhead, especially after llvm has had its way with it
<jhass> >> def foo; {1, 2}; end; a, b = foo; b
<DeBot> jhass: # => 2 - http://carc.in/#/r/cep
leafybasil has quit [Remote host closed the connection]
<jhass> %"{Int32, Int32}" = type { i32, i32 }
<jhass> %1 = call %"{Int32, Int32}" @"*foo:{Int32, Int32}"()
<jhass> %3 = getelementptr inbounds %"{Int32, Int32}"* %__temp_1, i32 0, i32 0
<jhass> I guess that's like returning a C struct?
<BlaXpirit> that seems to be the idea
<BlaXpirit> ok the implementation of Hash is just fine :)
kyrylo has quit [Ping timeout: 260 seconds]
<RX14> what's the best way to convert a Slice(Char) to a string?
<BlaXpirit> RX14, i think String.new(that) ?
<RX14> really?
<BlaXpirit> not sure, but there was something similar for sure
<RX14> i don't think it has one for Slice)Char)
<RX14> there's one that takes a slice of bytes
<RX14> Slice(UInt8)
<BlaXpirit> oh right!
<BlaXpirit> RX14, that.join
<RX14> and how do I turn a string into a slice of chars
<jhass> why do you have that anyway?
<jhass> are you really sure you don't want a Slice(UInt8)?
<BlaXpirit> RX14, s.chars gives an array
<RX14> but then I have to deal with unicode myself
<BlaXpirit> wha
<jhass> why do you have a Slice?
<BlaXpirit> i strongly suspect C lib is involved
<BlaXpirit> if not, then this is disturbind
<BlaXpirit> g
<RX14> no c is involved
<BlaXpirit> then this is disturbing
<RX14> ok
<Kilo`byte> are crystal strings null terminated or length based.
<Kilo`byte> i assume latter
<BlaXpirit> hm i never thought about this
<Kilo`byte> like, from my unit test code for ircv3 tags I'd say null terminated
<BlaXpirit> Kilo`byte, length is definitely involved
<BlaXpirit> and doesn't appear to be null terminated, but i'm not sure
<BlaXpirit> i wonder how to get a pointer to the data
<BlaXpirit> .cstr
<jhass> >> "foo".@buffer
<DeBot> jhass: Error in line 4: String doesn't have an instance var named '@buffer' - http://carc.in/#/r/cfz
<BlaXpirit> to_slice even
<BlaXpirit> jhass, it actually is @c :o
<BlaXpirit> and it seems like string has parts of it inside the compiler, not just stdlib
<RX14> >> "foo".to_slice
<DeBot> RX14: # => [102, 111, 111] - http://carc.in/#/r/cg1
<RX14> >> 102 == 'f'
<DeBot> RX14: # => false - http://carc.in/#/r/cg2
<jhass> >> 'f' == 102
<DeBot> jhass: # => false - http://carc.in/#/r/cg3
<RX14> hmmnph
<BlaXpirit> use chr, ord
<jhass> ah, but I think at least the latter might change
<Kilo`byte> jhass: you can access instance vars? wut
<BlaXpirit> >> "adsf".cstr.to_slice(10)
<DeBot> BlaXpirit: # => [97, 100, 115, 102, 0, 0, 0, 0, 0, 0] - http://carc.in/#/r/cg5
<jhass> Kilo`byte: eh yeah, but don't :D
<Kilo`byte> i was about to say
<jhass> Kilo`byte: hack for instance_variable_get replacement
<Kilo`byte> that sounds like a bad idea
<BlaXpirit> so who can answer: are strings 0 terminated or not?
<Kilo`byte> mhm
<RX14> >> "adfd".@c
<DeBot> RX14: # => 97 - http://carc.in/#/r/cg6
<Kilo`byte> meanwhile my sis just raged really hard for w/e reason
<jhass> >> "foo" as UInt8*
<DeBot> jhass: # => Pointer(UInt8)@0x805e9c8 - http://carc.in/#/r/cg8
<RX14> oh @c is the pointer to the beginning?
<BlaXpirit> >> "foo".to_unsafe.to_slice(10)
<DeBot> BlaXpirit: # => [102, 111, 111, 0, 1, 0, 0, 0, 1, 0] - http://carc.in/#/r/cg9
<BlaXpirit> RX14, don't use @c
<BlaXpirit> .cstr is the right way to access the same thing
<RX14> yeah i know
<BlaXpirit> and to_unsafe seems to be exactly the same as well
<jhass> >> b = ("foo" as UInt8*); Array.new(4) { |i| b[i] }
<DeBot> jhass: # => [1, 0, 0, 0] - http://carc.in/#/r/cga
<jhass> uh
<RX14> crystal strings must be null-terminated right?
<BlaXpirit> jhass, i don't think this casting is valid.
<BlaXpirit> RX14, length is used everywhere
<jhass> BlaXpirit: eh, right, it's a tuple actually
<RX14> but look at the def new with the yield
<RX14> doesn't it set the last char to be null?
bawNg_ has joined #crystal-lang
<BlaXpirit> great catch, RX14
<BlaXpirit> perhaps it does the same as Nim
<BlaXpirit> it probably does
<BlaXpirit> length is used everywhere
<BlaXpirit> but 0-termination is just a bonus for interoperability with C
<jhass> https://github.com/manastech/crystal/blob/master/src/string.cr#L201 so it's 0 terminated but has a header with the length
<jhass> yeah
<RX14> anyway if .cstr is just a pointer to the start, then it must be null-terminated or cstr wouldn't be nul-terminated
<BlaXpirit> "sdf\0asd" this wouldnt work
<BlaXpirit> >> "sdf\0asd" # this wouldnt work if 0termination meant anything
<DeBot> BlaXpirit: # => "sdf\u{0}asd" - http://carc.in/#/r/cgb
<jhass> >> String.new("sdf\0asd".cstr)
<DeBot> jhass: # => "sdf" - http://carc.in/#/r/cgd
<RX14> yup
<jhass> it means something when creating a new string from a C string, but that's expected
<jhass> since it just strlen's it
<RX14> so you can do it but if you use C code it will break
<jhass> well, there are C APIs that don't use 0 terminated strings either
<jhass> where you would pass s.cstr, s.bytesize
<RX14> hmmn I wonder if I have to worry about unicode if i'm dealing with a byte[]
<RX14> because I don't need to detect unicode just keep it intact
<jhass> you don't
<jhass> crystal strings are UTF-8 encoded
<BlaXpirit> + pretty sure utf-8 uses 0 byte only for 0 codepoint itself
<jhass> sure, it's ASCII compatible
<RX14> Slice of bytes out of string is how easy?
<BlaXpirit> RX14, huh?
vikaton has joined #crystal-lang
<jhass> .to_slice
<BlaXpirit> "я".to_slice
<RX14> ... derp
<BlaXpirit> >> "я".to_slice
<DeBot> BlaXpirit: # => [209, 143] - http://carc.in/#/r/cgi
<RX14> >> ":".to_slice[0] == ':'
<DeBot> RX14: # => false - http://carc.in/#/r/cgk
<BlaXpirit> RX14, you yourself used it 13 minutes ago :p
<RX14> yeah i have a short memory :P
<jhass> >> ":".to_slice[0] == ':'.ord
<DeBot> jhass: # => true - http://carc.in/#/r/cgl
<RX14> yeah that'll do
* RX14 rubs his hands in anticipation
<BlaXpirit> >> {"я".to_slice[0], 'я'.ord}
<DeBot> BlaXpirit: # => {209, 1103} - http://carc.in/#/r/cgm
<RX14> >> ":".to_slice.type
<DeBot> RX14: Error in line 4: undefined method 'type' for Slice(UInt8) - http://carc.in/#/r/cgo
<BlaXpirit> class
<RX14> so UInt8
<BlaXpirit> and it's Slice, what do u expect
<BlaXpirit> oh
<RX14> i thought .class and typed .type
<RX14> my hands have a mind of my own
leafybasil has joined #crystal-lang
<RX14> i'm trying to get an irc parser with the least memory copies as possible
<vikaton> glad to see Crystal growing
<jhass> most operations don't copy, they add new pointers and a small buffer for the new header
<jhass> since String is immutable
leafybasil has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
<Kilo`byte> RX14: hows your irc parser coming along
<RX14> well i've started
<RX14> is there a nice way to microbenchmark or do you ahve to roll your own?
<jhass> Benchmark.ips
<RX14> yup, found it
<RX14> if I wasn't on a shit laptop and could have the docs on another monitor...
<RX14> is there a UInt8 to char method for debugging?
<RX14> wait
<RX14> no, char doesn't have a constructor
<RX14> .to_s
<RX14> wow
<BlaXpirit> RX14, what do you want?
<RX14> i'm so think
<BlaXpirit> UInt8 is not a character
<RX14> i know
<BlaXpirit> your best hope is .chr
<BlaXpirit> but it is valid only for ascii!!!!
<RX14> >> 100.chr
<DeBot> RX14: # => 'd' - http://carc.in/#/r/chj
<RX14> well that should be fine for debugging
<RX14> that's all I want really
<Kilo`byte> >> 255.chr
<DeBot> Kilo`byte: # => 'ÿ' - http://carc.in/#/r/chk
<Kilo`byte> i wonder...
<BlaXpirit> what
<Kilo`byte> >> "\n"
<DeBot> Kilo`byte: # => "\n" - http://carc.in/#/r/chl
<Kilo`byte> good thats been taken care of
<BlaXpirit> >> Pointer(Int).null
<DeBot> BlaXpirit: Error in line 4: can't use Int as generic type argument yet, use a more specific type - http://carc.in/#/r/chm
<BlaXpirit> >> if Pointer(Int32).null; p ":("; end
<DeBot> BlaXpirit: # => nil - http://carc.in/#/r/chn
<Kilo`byte> >> !!Pointer(Int32)
<DeBot> Kilo`byte: # => true - http://carc.in/#/r/cho
<Kilo`byte> err
<Kilo`byte> >> !!Pointer(Int32).null
<DeBot> Kilo`byte: # => true - http://carc.in/#/r/chp
<BlaXpirit> o.o
<BlaXpirit> >> Pointer(Int32).null ? true : false
<DeBot> BlaXpirit: # => false - http://carc.in/#/r/chq
<BlaXpirit> >> !!(Pointer(Int32).null)
<DeBot> BlaXpirit: # => true - http://carc.in/#/r/chr
<BlaXpirit> ok then
<BlaXpirit> >> n = 5; {pointerof(n) or nil, Pointer(Int32).null or nil}
<DeBot> BlaXpirit: Syntax error in eval:4: expecting token '=>', not 'or' - http://carc.in/#/r/chs
<BlaXpirit> >> n = 5; {(pointerof(n) or nil), (Pointer(Int32).null or nil)}
<DeBot> BlaXpirit: Syntax error in eval:4: unterminated parenthesized expression - http://carc.in/#/r/cht
<BlaXpirit> >> n = 5; "#{pointerof(n) or nil} #{Pointer(Int32).null or nil}"
<DeBot> BlaXpirit: Syntax error in eval:4: Unterminated string interpolation - http://carc.in/#/r/chu
<BlaXpirit> come on, this is too much
<BlaXpirit> >> n = 5; p1 = pointerof(n) or nil; p2 = Pointer(Int32).null or nil; {p1, p2}
<DeBot> BlaXpirit: Syntax error in eval:4: unexpected token: or - http://carc.in/#/r/chv
<BlaXpirit> now i get it :D
<BlaXpirit> >> n = 5; {pointerof(n) or nil, Pointer(Int32).null or nil}
<DeBot> BlaXpirit: Syntax error in eval:4: expecting token '=>', not 'or' - http://carc.in/#/r/chx
<BlaXpirit> >> n = 5; {pointerof(n) || nil, Pointer(Int32).null || nil} # so sorry for spam :(
<DeBot> BlaXpirit: # => {Pointer(Int32)@0xbf86cb74, nil} - http://carc.in/#/r/chy
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
leafybasil has joined #crystal-lang
ssvb has quit [Ping timeout: 244 seconds]
Ven has quit [Ping timeout: 265 seconds]
<RX14> >> p "a" while true
<DeBot> RX14: Syntax error in eval:4: trailing `while` is not supported - http://carc.in/#/r/chz
<RX14> yeah i thought that got removed
blue_deref has joined #crystal-lang
ssvb has joined #crystal-lang
<RX14> apparently I can't call a private macro from another private macro
<Kilo`byte> also, i might look into a dbus lib
daphee has joined #crystal-lang
<BlaXpirit> Kilo`byte, what do you mean
<Kilo`byte> being able to use dbus from crystal
<BlaXpirit> Kilo`byte, well i started that already
<Kilo`byte> oh nice
<Kilo`byte> i hope nice and OOP? :P
<BlaXpirit> nobody cared about it so i kinda stopped
<Kilo`byte> oh :<
<Kilo`byte> well, i do care
<BlaXpirit> https://github.com/BlaXpirit/crystal-dbus status is pretty clear
<BlaXpirit> it's really difficult to figure out how to make receiving messages good
<BlaXpirit> it basically expects you to have an event loop
<Kilo`byte> well you can do that in background
<BlaXpirit> Kilo`byte, so what are your plans now?
<Kilo`byte> uh i'd really like to implement an interface to avahi
<Kilo`byte> and iirc that uses dbus
<Kilo`byte> although it also has c bindings i think
vikaton has quit [Quit: Connection closed for inactivity]
<RX14> >> x.nil?
<DeBot> RX14: Error in line 4: undefined local variable or method 'x' - http://carc.in/#/r/cia
<daphee> I have a question on how to get all matches with the Regex class. There is nothing like a "findall" function. So I tried using loops and the pos argument of match but nothing really works: http://carc.in/#/r/cic
<BlaXpirit> daphee, string.scan
<daphee> Cool, thanks. Don't know how I have missed that.
<BlaXpirit> daphee, well it's extremely difficult to find
<BlaXpirit> i would have no idea if not for that ruby search
<sardaukar> even on Ruby ppl seem to complain that it is on String and not on Regexp
kulelu88 has joined #crystal-lang
<jhass> they do? makes sense to me
<jhass> you scan the string, not the regex
<bjmllr> we have =~ and match on both string and regex, should we add scan to regex as well?
<BlaXpirit> no :|
<bjmllr> then should we remove the duplication of the other methods?
<BlaXpirit> =~ makes sense
<BlaXpirit> duplicate, that is
<BlaXpirit> because it's kinda symmetric, 1:1
<BlaXpirit> scan is like an n:1 operation
<BlaXpirit> i'm not making myself clear, am i
<bjmllr> they're all binary functions, but i kinda see what you mean. operators = ok to alias, named methods = ng
<BlaXpirit> no, it's not that
<bjmllr> is it because scan returns a collection?
<BlaXpirit> because scan uses 1 thing to find N things in a string
sleeper has left #crystal-lang ["tfw no sleeper"]
<bjmllr> it combines 1 regex and 1 string to find N matches. i'm not sure there's a particular order of regex and string that makes more sense than the other, but if there is i'd think it would apply equally to #match
<BlaXpirit> =~, match are a 1:1 operations, so everything makes sense to me
<bjmllr> (String, Regex) -> makes more sense than (Regex, String) -> in the case of -> Enumerable(MatchData) but not in the case of -> MatchData ?
<bjmllr> trying to understand your perspective on this
<BlaXpirit> i think it was something suggested by jhass, and i don't understand it, and removing the code had no consequences that i noticed
<jhass> guess something about not making it a generic and preventing a union somewhere, idk
<BlaXpirit> oooh, so i added the generic and happened to remove that piece of code after doing that
<BlaXpirit> probably would've broken otherwise
<RX14> ugh
<RX14> oh derp
<RX14> i forgot @ types were always nillable
<RX14> oh my god this is such a pain in the ass
<BlaXpirit> no, RX14, that's not true
<RX14> no, this macro is a pain in the ass
<jhass> just properly initialize your stuff
<RX14> okay it now parses the irc prefix
<RX14> so you can't use a private macro inside a macro
<RX14> it says it doesn't exist
bawNg_ has quit [Read error: Connection reset by peer]
kulelu88 has left #crystal-lang ["Leaving"]
Ven has joined #crystal-lang
<RX14> if I define a macro in a module, how do I use it
<RX14> wait private macros are per file...
<jhass> >> module Foo; macro self.bar; puts "hi"; end; end; Foo.bar
<DeBot> jhass: Error in line 4: undefined method 'bar' for Foo:Class - http://carc.in/#/r/cj8
<jhass> don't think you can use it outside
Ven has quit [Ping timeout: 252 seconds]
<crystal-gh> [crystal] bebac opened pull request #1264: Handle web socket close packet + add send method to web socket sessio… (master...websocket-close) http://git.io/vsKm1
<RX14> reported
Ven has joined #crystal-lang
<BlaXpirit> behavior seems wrong, makes sense
<RX14> well if I expanded that macro into real code it would work
<RX14> if you expand y manually then it works, so it's clearly a work
<RX14> s/work/bug/
<RX14> damn i'm tired
<RX14> can't even english
<RX14> if you have a non-private macro in a class how do you access it?
<RX14> outside the class
Ven has quit [Ping timeout: 255 seconds]
<jhass> I don't think you can atm
<jhass> maybe you want a macro def?
<RX14> i was just thinking what's the point of private macros in classes if they can't be accessed outside the class anyway!
<BlaXpirit> right
Ven has joined #crystal-lang
<jhass> >> class Foo; macro bar; end; end; class Bar < Foo; bar; end;
<DeBot> jhass: # => nil - http://carc.in/#/r/cjf
<jhass> >> class Foo; private macro bar; end; end; class Bar < Foo; bar; end;
<DeBot> jhass: # => nil - http://carc.in/#/r/cjg
<jhass> mmh
kyrylo has joined #crystal-lang
Ven_ has joined #crystal-lang
Ven has quit [Ping timeout: 272 seconds]
<Kilo`byte> DeBot: well, the macro gets expanded there
<Kilo`byte> to ""
<Kilo`byte> wait, derp
<BlaXpirit> xD
<RX14> Kilo`byte, is your irc parser on github?
<Kilo`byte> RX14: gist, but yes
<Kilo`byte> actually there is an old version
<Kilo`byte> sec
<RX14> i want to see the interface your IRCLine class provides
<Kilo`byte> yeah, check that link
<Kilo`byte> only a couple getters really
Ven_ has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
<RX14> hmmn string.to_slice isn't null terminated
<RX14> >> "a".to_slice
<DeBot> RX14: # => [97] - http://carc.in/#/r/cjh
<RX14> >> "a".bytelength
<DeBot> RX14: Error in line 4: undefined method 'bytelength' for String - http://carc.in/#/r/cji
<RX14> >> "a".bytelen
<DeBot> RX14: Error in line 4: undefined method 'bytelen' for String - http://carc.in/#/r/cjj
<jhass> size
<RX14> >> "a".bytesize
<DeBot> RX14: # => 1 - http://carc.in/#/r/cjk
<RX14> >> a = "a"; Slice.new a.cstr, a.bytesize + 1
<DeBot> RX14: # => [97, 0] - http://carc.in/#/r/cjl
<RX14> >> a = "a"; Slice.new a.cstr, a.bytesize + 4
<DeBot> RX14: # => [97, 0, 0, 0, 1] - http://carc.in/#/r/cjm
<RX14> yeah then you get unsafe
<RX14> >> a = "a"; Slice.new a.cstr, a.bytesize + 10
<DeBot> RX14: # => [97, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0] - http://carc.in/#/r/cjn
<RX14> >> a = "a"; Slice.new a.cstr, a.bytesize + 1
<DeBot> RX14: # => [97, 0] - http://carc.in/#/r/cjo
<RX14> so that's what I want for a null terminated byte
<RX14> the null termination really does make processing it a lot easier
<jhass> I wonder what happens if you send a nullbyte inside a message though
<jhass> >> puts "\o"
<DeBot> jhass: o - more at http://carc.in/#/r/cjp
<jhass> >> puts "\0"
<DeBot> jhass:
<jhass> >> puts "\0hi"
<DeBot> jhass:
<jhass> I guess it doesn't survive the service :p
<RX14> yeah
<RX14> wait
<RX14> >> "a\0b".bytesize
<DeBot> RX14: # => 3 - http://carc.in/#/r/cjt
<RX14> >> "a\0b".to_slice
<DeBot> RX14: # => [97, 0, 98] - http://carc.in/#/r/cju
<RX14> well basically don't
<RX14> my vim is running slow...
<RX14> how can this be
<jhass> anyway, it's there, just cut off since the size of course doesn't include it
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> any chance of crystal breaking that contract?
<jhass> I doubt that
<jhass> and the cstr has it
<RX14> well cstr doesn't have size
<BlaXpirit> RX14, bytesize is the size
<BlaXpirit> what do u mean
<RX14> ... never mind
<RX14> i wish I had a bigger screen :(
ssvb has quit [Ping timeout: 252 seconds]
ssvb has joined #crystal-lang
<RX14> man am I going to need to unit test this parser
<RX14> damn I really want to step through this in a debugger
<RX14> >> 0.chr
<DeBot> RX14: # => '\u{0}' - http://carc.in/#/r/ckw
<RX14> >> p 0.chr
<DeBot> RX14: '\u{0}' - more at http://carc.in/#/r/ckx
<RX14> >> while true; break; end
<DeBot> RX14: # => nil - http://carc.in/#/r/cky
<RX14> why is...
<BlaXpirit> RX14, what do u want?
<BlaXpirit> wondering why this is printed out?
<RX14> no break doesn't seem to work in my while loop
<RX14> probably just me
<BlaXpirit> yes
<jhass> RX14: keep in mind it breaks from blocks too
<jhass> while true; something { break }; end # endless loop
<RX14> yup
<RX14> i know
<RX14> but it's not
<RX14> i'm really confused
<jhass> well, can't hint anything without the code
<RX14> i'm really really confused
<crystal-gh> [crystal] asterite pushed 5 new commits to master: http://git.io/vsKy7
<crystal-gh> crystal/master 3af1bb9 Oleh Prypin: Add `pred` to Int and Char
<crystal-gh> crystal/master 44ef2bb Oleh Prypin: Add specs for `succ` and `pred`
<crystal-gh> crystal/master 492e152 Oleh Prypin: Add Range#reverse_each
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vsKSZ
<crystal-gh> crystal/master 8776e64 Konstantin Makarchev: add array#rotate
<crystal-gh> crystal/master 6802d1e Konstantin Makarchev: little fix
<crystal-gh> crystal/master 67e3298 Konstantin Makarchev: copy seems faster
zamith has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vsKSS
<crystal-gh> crystal/master 08c8e97 Tobias Pfeiffer: Spec/sort/doc remaining Enumerable methods...
<crystal-gh> crystal/master 5bbde2e Ary Borenszweig: Merge pull request #1238 from PragTob/spec-more-enumerable...
<RX14> it was my fault
<RX14> i swear I had exactly the same code before and it didn't work but that's how it always goes
<crystal-gh> [crystal] asterite closed pull request #1244: Added HTML parsing to XML module, references #1240 (master...html_parser_with_libxml2) http://git.io/vsnSi
<RX14> ok my irc library looks to kinda work
<RX14> now to bend the unit tests into compiling
<crystal-gh> [crystal] asterite closed pull request #1247: Env (master...env) http://git.io/vslJR
<14WAAW4DD> [crystal] asterite pushed 5 new commits to master: http://git.io/vsKHS
<14WAAW4DD> crystal/master cafec4a Will Leinweber: ENV: add documentation
<14WAAW4DD> crystal/master cafea9a Will Leinweber: ENV: #[]= returns the value that was set
<14WAAW4DD> crystal/master cafe2be Will Leinweber: ENV: add .keys and .values
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vsKQf
<crystal-gh> crystal/master ac04727 Tobias Pfeiffer: Sorted Iterator methods
<crystal-gh> crystal/master 3d5ed1e Tobias Pfeiffer: Put Iterator implementations beneath method definitions...
<crystal-gh> crystal/master a58192d Tobias Pfeiffer: Sort the iterator spec files
<travis-ci> manastech/crystal#39f5e91 (master - Merge pull request #1217 from BlaXpirit/range-reverse-each): The build passed. https://travis-ci.org/manastech/crystal/builds/76895188
<travis-ci> manastech/crystal#9345d94 (master - Merge pull request #1236 from kostya/rotate): The build passed. https://travis-ci.org/manastech/crystal/builds/76895399
lukas has left #crystal-lang ["WeeChat 0.4.2"]
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vsK7e
<crystal-gh> crystal/master 251216e Jonne Haß: Fix a File.expand_path spec to not expect to be run in a two level deep...
<crystal-gh> crystal/master 0e7fc22 Jonne Haß: run 32bit on travis via docker
<crystal-gh> crystal/master 95806c3 Ary Borenszweig: Merge pull request #1249 from jhass/docker_travis...
<jhass> <3
<RX14> what bot is this for the github?
<RX14> it's so colourless
<BlaXpirit> RX14, so change settings in your client
<BlaXpirit> it's the only good way to do this
<RX14> umm, no
<BlaXpirit> what no
<RX14> you expect me to parse it and colourise it?
<BlaXpirit> no
<RX14> the bot should emit colour codes
<crystal-gh> [crystal] asterite closed pull request #1250: Add StaticArray#== for equality comparisons (master...static-array-equality) http://git.io/vsRHb
<RX14> oh the channel is +c?
<RX14> that explains the lack of colours
<travis-ci> manastech/crystal#5bbde2e (master - Merge pull request #1238 from PragTob/spec-more-enumerable): The build passed. https://travis-ci.org/manastech/crystal/builds/76895490
<BlaXpirit> RX14, the bot should not emit color codes, it's doing the right thing
<BlaXpirit> it gives channel notices
<BlaXpirit> my irc client displays them in brownish yellow
<RX14> yeah but it would look so much nicer if it was coloured properly
<crystal-gh> [crystal] decioferreira opened pull request #1266: Add documentation for Array#delete_at and Array#delete_if (master...array-delete_at-delete_if) http://git.io/vsK7y
<RX14> i'm talking about colourising parts of the message, not the whole message
<BlaXpirit> oh ok, sorry. i still like this best
<BlaXpirit> there is a bonus that it trigger the irc client saying there was a new message in this room
<RX14> i'm used to it looking nice, the colours amke it easier to distinguish the syntax of the message
<BlaXpirit> that it DOES NOT* trigger
<RX14> yeah it should be NOTICE
<RX14> but AFAIK it's actually the github bot
<RX14> the one set in the services section
<RX14> and that does emit colours
<RX14> by default
<RX14> it's just that this room is +c
<travis-ci> manastech/crystal#75072fe (master - Merge pull request #1247 from will/env): The build passed. https://travis-ci.org/manastech/crystal/builds/76896389
<travis-ci> manastech/crystal#e2eea7c (master - Merge branch 'html_parser_with_libxml2' of https://github.com/ryanworl/crystal into ryanworl-html_parser_with_libxml2): The build passed. https://travis-ci.org/manastech/crystal/builds/76895895
<travis-ci> manastech/crystal#cfabd80 (master - Merge pull request #1248 from PragTob/sort-iterator-methods): The build passed. https://travis-ci.org/manastech/crystal/builds/76896487
<crystal-gh> [crystal] asterite pushed 6 new commits to master: http://git.io/vsKFc
<crystal-gh> crystal/master cafe898 Will Leinweber: StringScanner: docs and specs
<crystal-gh> crystal/master cafec0a Will Leinweber: StringScanner: add #[] and #[]?
<crystal-gh> crystal/master cafe861 Will Leinweber: StringScanner: add several helper methods...
<travis-ci> manastech/crystal#95806c3 (master - Merge pull request #1249 from jhass/docker_travis): The build passed. https://travis-ci.org/manastech/crystal/builds/76896970
<travis-ci> manastech/crystal#8bb7c40 (master - Merge pull request #1250 from tatey/static-array-equality): The build passed. https://travis-ci.org/manastech/crystal/builds/76897275
<RX14> oh shit the specs compile!
<crystal-gh> [crystal] asterite closed pull request #1258: add String#sub (master...string_sub) http://git.io/vsgc3
<travis-ci> manastech/crystal#ffd070d (master - Merge pull request #1254 from will/stringscanner): The build passed. https://travis-ci.org/manastech/crystal/builds/76898573
<travis-ci> manastech/crystal#e954d44 (master - Merge pull request #1258 from jhass/string_sub): The build passed. https://travis-ci.org/manastech/crystal/builds/76899502
BlaXpirit has quit [Quit: Konversation]
Mo0O has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] asterite pushed 13 new commits to master: http://git.io/vsKpn
<crystal-gh> crystal/master ee0ea54 Ben Miller: regex.cr: sort methods by name
<crystal-gh> crystal/master 4afda56 Ben Miller: regex: convert #options to a getter
<crystal-gh> crystal/master abd81c0 Ben Miller: regex: document existing methods
<crystal-gh> [crystal] asterite closed pull request #1266: Add documentation for Array#delete_at and Array#delete_if (master...array-delete_at-delete_if) http://git.io/vsK7y
<travis-ci> manastech/crystal#def47c8 (master - Merge pull request #1262 from bjmllr/regex): The build passed. https://travis-ci.org/manastech/crystal/builds/76901087
<travis-ci> manastech/crystal#c855a81 (master - Merge pull request #1266 from decioferreira/array-delete_at-delete_if): The build passed. https://travis-ci.org/manastech/crystal/builds/76901665
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vsKjo
<crystal-gh> crystal/master 6b9eb0a Ary Borenszweig: Tiny Enumerable doc fixes. Related to #1238
<crystal-gh> crystal/master cea3d6a Ary Borenszweig: Parser: missing function literal argument location
<crystal-gh> crystal/master e0074b1 Ary Borenszweig: XML: parse_html from IO. Related to #1244
<RX14> most non-ircv3 spec pass now!
<RX14> time to go to bed
<jhass> night!
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vs6eZ
<crystal-gh> crystal/master ba05360 Ary Borenszweig: Allow comparing StaticArrays of different types. Related to #1250
<crystal-gh> crystal/master 08d5218 Ary Borenszweig: Tiny fix in Regex docs for `options`. Related to #1262
<travis-ci> manastech/crystal#e0074b1 (master - XML: parse_html from IO. Related to #1244): The build passed. https://travis-ci.org/manastech/crystal/builds/76902470
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vs6eN
<crystal-gh> crystal/master be7c803 Ary Borenszweig: Better document `eval` command. Related to #1263
Mo0O has joined #crystal-lang
<travis-ci> manastech/crystal#08d5218 (master - Tiny fix in Regex docs for `options`. Related to #1262): The build has errored. https://travis-ci.org/manastech/crystal/builds/76902919
<travis-ci> manastech/crystal#be7c803 (master - Better document `eval` command. Related to #1263): The build passed. https://travis-ci.org/manastech/crystal/builds/76903339
<RX14> there we go
<Kilo`byte> RX14: didn't you want to go to bed? :P
<RX14> well i'm trying
<RX14> but i'm bad at such things as turning my computer off
<Kilo`byte> RX14: also scanned through your code and i may have found a flaw
<jhass> ew, too many spaces :P
<RX14> Kilo`byte, yup?
<Kilo`byte> looks like you assume that a prefix always contains nick, user and host
<Kilo`byte> however it may not
<RX14> i don't
<RX14> i assume it contains a nick
<RX14> and the user and host are optional
<Kilo`byte> there are also times where there only is a host
<Kilo`byte> ie: when you get a server message
<Kilo`byte> not uncommon when for example 2 servers link
<RX14> yup
<RX14> right here
<RX14> it will skip those and the two other paramethers will be nil
<Kilo`byte> just curious
<RX14> it should work
<Kilo`byte> can you push lines from outside into your library?
<RX14> I havent tested it
<RX14> Kilo`byte, what do you mean?
<Kilo`byte> that'd be useful as fuck for stuff like epoll (servers!)
<Kilo`byte> like, you don't force using one thread per user
<Kilo`byte> or even 2 (one for reading, one for writing)
daphee has left #crystal-lang [#crystal-lang]
<RX14> i don't have anything but [parsing
<Kilo`byte> aic
<RX14> so whatever network shizz doesn't matter
<Kilo`byte> an irc server usually will run on like one or two treads in total and can easily handle 1k connections :P
<Kilo`byte> thanks to epoll
<RX14> well i havent benchmarked this
<RX14> it would be nice if you could for me
<RX14> but it's midnight
<RX14> so i'm off
<Kilo`byte> things like nginx up that. i've read its been reported to have 6 million simultanious connections on probably way below 20 threads
<Kilo`byte> night :P
<Kilo`byte> jhass: how efficient is the web server implementation actually
<jhass> 42 efficient
<Kilo`byte> actually, does crystal have an async io thingy yet?
<Kilo`byte> if not i may look into that
<jhass> sort of, all IO is evented
<jhass> if you spawn a coroutine and IO would block a different coroutine is scheduled
<Kilo`byte> well, i mean like, a concrete one, kinda like eventmachine
<jhass> only if all are blocked it stalls
<Kilo`byte> jhass: what does it use in background? poll? select? epoll?
<jhass> libevent2
<jhass> (guess that's epoll?)
<Kilo`byte> wouldn't surprise me if that used epoll
<Kilo`byte> now the question is just: how much does a coroutine switch cost (performance wise)
<Kilo`byte> libevent2 does support epoll, idk is it uses that by default
<Kilo`byte> (ofc on linux that is, as epoll is linux specific)
<jhass> if you take a look at that branch you can see it that's really just swapping out the stackframe
<Kilo`byte> heh
<Kilo`byte> how'd i spawn a coroutine?
<jhass> spawn
<jhass> >> spawn do puts "yay" end
<DeBot> jhass: # => [#<Fiber:0x91a7f30 @cr=Pointer(Void)@0xb63f6000, @proc=#<( -> Void):0x804fdd0>, @stack=Pointer(Void)@0xb63f6000, @stack_top=Pointer(Void)@0xb6bf6000, @stack_bottom=Pointer(Void)@0xb6bf6000, @next_fiber=#<Fiber:0x91a7f00 @cr=Pointer(Void)@0xb5bf6000, @proc=#<( -> Void):0x80502b0>, @stack=Pointer(Void)@0xb5bf6000, @stack_top=Pointer(Void)@0xb63f ... - http://carc.in/#/r/cll
<jhass> heh, should block the main one I guess
<Kilo`byte> so how'd i create a thread? or does crystal not support those
<jhass> >> spawn do puts "yay" end; sleep 1;
<DeBot> jhass: Error in line 7: undefined method 'inspect' for Void - http://carc.in/#/r/clm
<jhass> >> spawn do puts "yay" end; sleep 1; 1
<DeBot> jhass: yay - more at http://carc.in/#/r/cln
<Kilo`byte> because i assume mutexes and stuf do not work in coroutines
<jhass> well, for now it's single threaded so you wouldn't need to care about locking
<Kilo`byte> also i assume coroutines use cooperative multitasking
<jhass> but Thread.new is still there (mapping out pthread)
<jhass> just IO inside it is pretty much broken in all aspects due to the event loop being in the main thread and stuff
<Kilo`byte> which is nice in most cases but can cause issues in others
<Kilo`byte> (sure, this isn't OS level, where programs are expected to be isolated. On the other hand: preemptive multitasking requires help from the OS which itself needs help from the CPU)
<travis-ci> manastech/crystal#08d5218 (master - Tiny fix in Regex docs for `options`. Related to #1262): The build passed. https://travis-ci.org/manastech/crystal/builds/76902919
<Kilo`byte> i am actually not sure if i like the implicit event based io
<Kilo`byte> its a nice thing to have certainly
<Kilo`byte> it might break on some low-level stuff though
<jhass> anyway, this is just what stdlib is going to do, I expect libraries to happen that sidestep all of this and provide class pthread concurrency and stuff
<Kilo`byte> yeah
<Kilo`byte> but, this actually means using this for high-performance applications is pretty nice
<jhass> er, classic.
<Kilo`byte> also, i should actually rewrite the library i wrote in ruby a long time ago for linking to an inspircd in crystal (i lost the ruby version to a file system failure)
<Kilo`byte> the thing that eventually made me give up was that debugging with dynamic typing was a pain
<Kilo`byte> even though i had a debugger, you always had to remember what type a variable was supposed to be
<jhass> mmh
<Kilo`byte> like, for irc server applications imo its better to just link to an existing irc server
<jhass> well current state is that debugging ruby is a lot easier actually. It's just that crystal catches more stuff at compile time already
<jhass> but hard to beat pry + pry-byebug + pry-stack_explorer
<Kilo`byte> you get more performance usually and certainly more features
<Kilo`byte> jhass: i am using rubymines builtin debugger (uses ruby-debug-ide iirc)
<Kilo`byte> for crystal its gdb ofc
<Kilo`byte> (kinda a pita due to lack of line numbers though)
<jhass> yeah, bummer they changed the debug info format
<jhass> and gonna change it again with 3.7
<Kilo`byte> does crystal ship with a proper TLS implementation?
<jhass> openssl binding in stdlib
<Kilo`byte> ic
<Kilo`byte> no gnutls?
<jhass> haven't seen any
<Kilo`byte> because gnutls has better performance from what i know
<jhass> but I long lost track of every new repo created
<Kilo`byte> but at least something
<Kilo`byte> since server links should run over TLS
<jhass> oh and improved openssl binding at datanoise/openssl.cr iirc
<Kilo`byte> heh neat
<Kilo`byte> tbh, i'd much prefer abstract apis for things like that
<jhass> think they want to merge it back to stdlib at some point
<Kilo`byte> so i as a developer don't have to care about what backend is used for TLS
<Kilo`byte> ofc that does not work too well if you need low-level stuff
<Kilo`byte> like persisting TLS state
<Kilo`byte> also i am considering to expand my irc parser to a full blown server and client library
<Kilo`byte> not sure if that'd be worth it though
<asterite> jhass: I highly recommend you to watch this talk: https://www.youtube.com/watch?v=449j7oKQVkc
<jhass> already did :D why?
<asterite> :o
<Kilo`byte> asterite: sounds interesting
<asterite> Well, it explains why having threads as a concurrency primitive is bad
<Kilo`byte> thanks for that Pointer(Video)
<asterite> And many new languages are moving away from threads, for example Julia and Go
<asterite> (and Crystal :-P)
<asterite> I was actually against that, when waj suggested it, because threads are simple and known, but now I agree with him
<jhass> asterite: I said it a couple of times in the past, I think what you do is perfectly fine for stdlib and as default
<Kilo`byte> also dang, i just had a really good idea and its gone now
<asterite> Ah, OK. I'm just not sure it would even be possible to have user threads mixed with coroutines, that's all (but waj mentioned it at one point to me, so I guess he knows what he's talking about :-))
<jhass> more classic concurrency approaches are just extremely well understood, so having them available (as third party libraries, not in stdlib) for the cases where you just know it's a more perfect fit would be awesome IMO ;)
<Kilo`byte> right, is there any interest in having bindings for a scripting language? (would probably pick lua as it has a very simple c api)
<Kilo`byte> could be very useful for plugin systems
<jhass> and no, I'm not thinking about mixed at all
<Kilo`byte> since crystal doesn't really support runtime loading plugins written in crystal
<jhass> if you go pthreads you'll need to abandon stdlib concurrency & IO at the same time
<asterite> Kilo`byte: Maybe this? https://github.com/pine613/crystal-lua
<asterite> Always check http://crystalshards.herokuapp.com :-)
<jhass> you should do mruby :P
<Kilo`byte> hmmm
<Kilo`byte> actually sounds like a decent idea
<Kilo`byte> and like a bigger project
<Kilo`byte> that'd also allow to use things like haml from crystal :D
<jhass> oh, there's haml for mruby already?
<Kilo`byte> sec
<Kilo`byte> well, afaik haml itself is written in pure ruby
<Kilo`byte> might be wrong there
<jhass> mruby is a subset of ruby though
<Kilo`byte> ic
<Kilo`byte> asterite: also thanks for that video link. i finally start to understand what monads are :D
<jhass> Kilo`byte: or do you? http://two-wrongs.com/the-what-are-monads-fallacy :P
<Kilo`byte> well, i start to get the general idea
<Kilo`byte> i have a friend who understands them but he never was able to explain it in any understandable way
<Kilo`byte> will read that after the video
<jhass> tom stuarts talk is great too, though I'm afraid it falls into the fallacy ;D
zamith has quit [Quit: Be back later ...]
<Kilo`byte> "it looks like node.js"
<Kilo`byte> i like that guy