jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.5.8 | 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
tmoore_ is now known as tmoore
<crystal-gh> [crystal] asterite closed pull request #400: Fix: leaking file descriptors on socket creation errors (master...close-sockets-on-errors) http://git.io/bPMx
asterite has joined #crystal-lang
<travis-ci> manastech/crystal#1934 (master - 2384d92 : Ary Borenszweig): The build passed.
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
asterite has quit [Client Quit]
asterite has joined #crystal-lang
asterite has quit [Client Quit]
asterite has joined #crystal-lang
<asterite> If it’s crystal code then yes, it’s beautiful :)
<asterite> For a second I thought chrome would die, but it managed to render that
<asterite> and github colored it too! :)
<jhass> still kind of baffled this actually works :D https://github.com/jhass/crystal-gobject/blob/master/src/gtk.cr#L26
<asterite> That’s it? That’s all you needed to do?
<jhass> yeah, the hardest part was the swapped at the end xD
<jhass> else it was passing instance (first arg) as first arg when invoking the Function
<asterite> Mm… but I thought our closures had the closure data as a first argument
<asterite> Oh, yes, swap sends it as first, non-swap sends it as las
<asterite> t
<asterite> So the wrapper for closures in crystal is the shortest one? :)
<asterite> (for gobject closures)
<jhass> so far
<jhass> for the simple cases
<jhass> I have no idea how it holds up to more complex ones
<jhass> my GTK is rusty anyway
<jhass> I guess binding glade would be fun
<asterite> I hope you don’t mind I star and watch every crystal project in github :)
<jhass> nah, why would I
<asterite> Hey, you are famous! https://crystalshards.herokuapp.com/
<asterite> It would be nice to see the user of the project in that list
<jhass> hehe, most stars were accumulated by the Ruby version though :P
<asterite> It seems you found out about &->Gtk.quit :)
<asterite> The hello world sample looks really clean
<jhass> didn't you give it away earlier?
<asterite> Oh, I forgot you could do ->.. and then use it together with &
<asterite> The &-> symbol looks cute :)
<jhass> yeah :D
<asterite> I mean, I think I didn’t know that was even possible or that it parsed
<jhass> :D
<asterite> Could it work in mac?
waj has joined #crystal-lang
<jhass> good question
<jhass> Gtk works in windows, so I guess it works in Mac too, but no idea
<jhass> linking will probably fail, I basically guess it currently
<asterite> I also see that you used redefine_main. It seems it has its uses :)
<jhass> it's boilerplate every Gtk program needs, so why not
<jhass> gtk_main() spins up an event loop and then blocks
<jhass> after that everything happens on callbacks or in separate threads you need to spin up before that or in a callback
<jhass> wow, didn't expect that :D
<asterite> I really, really like it that I can download a project, install the dependencies and just do `crystal sample.cr` to make it work :)
<asterite> True, mine’s too colorful
<asterite> Parse: 00:00:00.0881180
<asterite> Type inference: 00:00:00.0865680
<asterite> I would have thought it would take more time for those huge bindings
<asterite> Computers are fast :)
<waj> nice!! good job!
<jhass> Gtk is crazy, see what the broadway backend does: http://cloud.aeshna.de/u/mrzyx/screenshots/screenshot_20150207_022436.png
<asterite> Changes the style?
<jhass> it's not over my browser
<jhass> it's in it
<asterite> :o
<asterite> wat?
<jhass> do you have brodwayd on mac?
<asterite> Maybe… how can I try it?
<jhass> if so, do broadwayd -p 8080 &; GDK_BACKEND=broadway ../bin/crystal ...
<jhass> open localhost:8080 in your browser
<jhass> (Yes, GDK, not GTK)
<asterite> I think I don’t have broadwayd :(
<jhass> maybe just not in the $PATH?
<jhass> but maybe they didn't port it
<asterite> I can’t find the binary in my installation, so maybe it’s not available for mac
<asterite> Again, you generated those bindings with gobject introspection?
<jhass> yeah
<asterite> Is that some kind of ffi-gen?
<jhass> is basically the entry point to that glory mess
<jhass> I never really looked at what ffi-gen does
<asterite> If you compile the hello world with —release, the resulting binary is about 17k :)
<jhass> all the heavy stuff is linked in^^
<asterite> It seems so :)
<asterite> Mmm… wait, you are generating the bindings with crystal?
<jhass> sort of
<asterite> Where did you get your superpowers?
<jhass> I bound the necessary stuff by hand before generating itself with it
<asterite> I want to go there :-P
<jhass> (+ glib)
<jhass> everything that doesn't start with lib_ is hand-written atm
<asterite> Can that generate bindings for, say, libuv?
<jhass> let's see
<asterite> libuv heavily uses macros… you can try with pcre
<jhass> I doubt it though
<jhass> what GI does is, it scans header files following the gobject conventions/using gobject
<asterite> Aaah… ok
<jhass> produces XML descriptions for them (.gir extension) and compiles those to a more efficient binary format (.typelib)
<jhass> those typelib files are then what you read with the library to get runtime objects describing the stuff
<jhass> (GIBaseInfo, GIStructInfo, GIFunctionInfo,...)
<asterite> And I thought once you finished DeBot you would get bored of Crystal…
<asterite> (not really :-P)
<jhass> that's what I have .typelib's available for on my system
<asterite> Your prompt is cool :)
<asterite> Thanks :)
asterite has quit [Quit: asterite]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/bXdM
<crystal-gh> crystal/master 624f006 Ary Borenszweig: Fixed: `can't reopen enum and add more constants to it` error didn't have a location
asterite has joined #crystal-lang
<travis-ci> manastech/crystal#1935 (master - 624f006 : Ary Borenszweig): The build passed.
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/b1fj
<crystal-gh> crystal/master 1c80ced Ary Borenszweig: Use enums for socket type, protocol and family instead of constants
<crystal-gh> crystal/master 06fe838 Ary Borenszweig: Updated Changelog
<travis-ci> manastech/crystal#1936 (master - 06fe838 : Ary Borenszweig): The build passed.
waj has quit [Quit: Leaving.]
zamith__ has quit [Quit: Be back later ...]
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/b1GD
<crystal-gh> crystal/master 80b3ea3 Ary Borenszweig: Fill argument types when passing a function pointer to a C function (like in `->foo` or `->Foo.bar`). Also, renamed `MacroType` to `TypeNode` because now its also used outside macros.
<travis-ci> manastech/crystal#1937 (master - 80b3ea3 : Ary Borenszweig): The build passed.
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/b1lo
<crystal-gh> crystal/master 2450432 Ary Borenszweig: Removed some dead code
<travis-ci> manastech/crystal#1938 (master - 2450432 : Ary Borenszweig): The build passed.
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
r20 has quit [Ping timeout: 240 seconds]
drizz has quit [Remote host closed the connection]
drizz has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden opened pull request #401: Logger (master...std-logger) http://git.io/bMYG
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
waj has quit [Client Quit]
<jhass> >> a = /a/; b = /#{a}/
<DeBot> jhass: //a//
<jhass> mmh
waj has joined #crystal-lang
waj has quit [Client Quit]
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
DeBot has quit [Quit: Crystal]
DeBot has joined #crystal-lang
kgadek has quit [*.net *.split]
kgadek has joined #crystal-lang
asterite has joined #crystal-lang
asterite has quit [Remote host closed the connection]
asterite has joined #crystal-lang
<asterite> jhass: I didn't know that about interpolating a regex into another regex
<asterite> An easy solution is to have those literals use a RegexStringIO, which overload <<(Regex) and append the source
<asterite> What do you think?
<jhass> not sure, it's a bit more complex
<asterite> Why?
<jhass> try a = /foo/i; /a#{a}a/ in ruby
<jhass> see the ?i-mx ?
<jhass> it caries over the flags just for that part
<jhass> not sure if pcre can even do that tbh
<jhass> asterite: wanna help construct a https://developer.gnome.org/gobject/stable/gobject-Generic-values.html from Crystal? I fail miserably
<asterite> Sure! Why is it failing?
<jhass> let's pretend I have nothing, all variants I tried fail differently
<jhass> if I heap allocate it (ptr = Pointer(LibGObject::Value).malloc(1)) it's at least not segfaulting
<jhass> but it also claims I never set a value
<jhass> or I didn't set a string for that matter
<jhass> GLib-GObject-CRITICAL **: g_value_set_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
<jhass> with strct :: LibGObject::Value
<jhass> ptr = pointerof(strct)
<jhass> I get gvalue.c:181: cannot initialize GValue with type 'guchar', the value has already been initialized as '(null)'
<jhass> and a segfault after that
<jhass> common code is LibGObject.value_init(ptr, Type::STRING)
<jhass> LibGObject.value_set_string ptr, value
<jhass> LibGObject.object_set_property object, property, ptr
<asterite> I'll try it here
<jhass> STRING = LibGObject.type_fundamental(16_u64)
<asterite> I get this: (<unknown>:48574): GLib-GObject-CRITICAL **: g_value_set_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
<asterite> So I think we are with the same code now :)
<jhass> ;)
<asterite> Are you sure STRING is 16?
<jhass> fairly
<asterite> If you try it in a C program it works?
<jhass> mmh,STRING = LibGObject.type_fundamental(16_u64) might actually be wrong
<jhass> hit the wrong macro
<jhass> dang, that's it
<jhass> thanks!
<asterite> Really? :)
<jhass> really
<asterite> What was it?
<jhass> 16.to_u64 << 2 is the correct value for STRING
<asterite> Cool :)
<jhass> one thing I wonder though, why do I have to heap allocate it?
<jhass> isn't the example stack allocated?
<asterite> Yes, you can stack allocate it too
<jhass> it's segfaulting and throwing errors though
<asterite> Strange
<asterite> I did
<asterite> LibGObject.value_init(out ptr, STRING) LibGObject.value_set_string pointerof(ptr), "hello" LibGObject.value_set_string pointerof(ptr), "hello"
<jhass> ah, out I didn't try
<asterite> But with :: it should work too
<jhass> it doesn't for me
<asterite> althought both :: and out don't zero-initialize it, and maybe gtk requires it to be zero
<asterite> ?
<asterite> Pointer.malloc zeroes
<asterite> And new also zeros
<jhass> maybe
<jhass> maybe you just had luck to hit a bunch of zeros on your system
<asterite> ptr = LibGObject::Value.new LibGObject.value_init(pointerof(ptr), STRING)
<asterite> Maybe
<jhass> see, I really think :: and out should zero ;)
<jhass> what's that last one, a trick to zero it?
<asterite> Struct.new zeroes
<jhass> ah, missing ;
<asterite> But, yes, probably :: and out should zero too
<jhass> it bit me several times now, I think it's no question
asterite has quit [Ping timeout: 246 seconds]
asterite has joined #crystal-lang
asterite has quit [Quit: Page closed]
<crystal-gh> [crystal] asterite pushed 8 new commits to master: http://git.io/by7B
<crystal-gh> crystal/master 13de017 Julien Portalier: Added: String#rjust and String#ljust
<crystal-gh> crystal/master b7c4c1f Julien Portalier: Added: IO.pipe(&block)
<crystal-gh> crystal/master b19c350 Julien Portalier: Added: match expectation
<travis-ci> manastech/crystal#1941 (master - d39d9c7 : Ary Borenszweig): The build passed.
DeBot has quit [Ping timeout: 252 seconds]
<jhass> >> String.class.name
<jhass> eh, where's the bot
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/bSIQ
<crystal-gh> crystal/master 0c58dd6 Ary Borenszweig: Some fixes to docs generation
<crystal-gh> crystal/master 8af8e7b Ary Borenszweig: Some changes and docs for Logger
DeBot has joined #crystal-lang
<jhass> >> String.class.name
<DeBot> jhass: Error in line 3: undefined method 'name' for Class
<travis-ci> manastech/crystal#1942 (master - 8af8e7b : Ary Borenszweig): The build passed.
DeBot has quit [Quit: Crystal]
DeBot has joined #crystal-lang
<jhass> >> class B < A; end; class A; end;
<DeBot> jhass: Error in line 3: undefined constant A
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/bSEs
<crystal-gh> crystal/master 73b0b68 Ary Borenszweig: Small typo in Changelog
<crystal-gh> crystal/master ae8212c Ary Borenszweig: Crystal 0.5.9
<travis-ci> manastech/crystal#1943 (master - ae8212c : Ary Borenszweig): The build passed.
<jhass> haha, expected 0.6 on that one :P
waj has joined #crystal-lang
<jhass> waj: update topic? ;)
<waj> 0.5.9!! yay! :D
<jhass> waj: why still bugfix bump btw? certainly new features there :P
<waj> very true
<waj> we should ask asterite ;)
<jhass> totally expected 0.6 ;)
asterite has joined #crystal-lang
<asterite> jhass: I don't like even numbers ( ? )
<jhass> heh
<jhass> you know SemVer though? :P
<asterite> Yes, but...
<asterite> Mmm...
<asterite> In 0.x anything is allowed XD
asterite has quit [Quit: Page closed]
DeBot has quit [Ping timeout: 252 seconds]
DeBot has joined #crystal-lang
waj has quit [Quit: Leaving.]
waj has joined #crystal-lang
r20 has joined #crystal-lang
the_asterite has joined #crystal-lang
<the_asterite> jhass: my bad, I think 0.6 makes more sense
<the_asterite> I just fear reaching 0.9, feels almost like 1.0 (I know it's not)
<jhass> we can jump from 0.8 to 0.10 :P
<jhass> and you sure you don't want an account on my bouncer? ;D
<jhass> btw. no I'd like to do reference constants defined in the same file before they're defined outside libs (inside a module) too :P
<jhass> *now
filer__ has joined #crystal-lang
endou_______ has joined #crystal-lang
drizz has quit [Ping timeout: 245 seconds]
endou______ has quit [Ping timeout: 245 seconds]
filer has quit [Ping timeout: 245 seconds]
drizz has joined #crystal-lang
<the_asterite> why?
<jhass> >> class B < A; end; class A; end;
<DeBot> jhass: Error in line 3: undefined constant A
<jhass> essentially, but in a module
<the_asterite> are you generating that with a tool?
<the_asterite> Even in Ruby that doesn't work
<jhass> yeah same thing as in the libs really
<jhass> toying with generating the wrapper classes
<jhass> I probably could put every one in its own file and generate the require for the parent, but meh
<jhass> also Ruby has .const_missing and Module.new :P
drizz has quit [Ping timeout: 245 seconds]
drizz has joined #crystal-lang
<the_asterite> Hehe, right
<the_asterite> I'm not sure about this last thing, though
the_asterite has quit [Quit: qicr for android: faster and better]
ryanf has quit [Ping timeout: 252 seconds]
drizz has quit [Ping timeout: 240 seconds]
ryanf has joined #crystal-lang
drizz has joined #crystal-lang
drizz has quit [Ping timeout: 245 seconds]
drizz has joined #crystal-lang