jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.7 | 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
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Client Quit]
waj has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
nakilon has joined #crystal-lang
nakilon has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] waj pushed 1 new commit to master: http://git.io/vZjyW
<crystal-gh> crystal/master 898ee13 Juan Wajnerman: Add debug metadata for local variables of integer types
waj_ has quit [Remote host closed the connection]
<travis-ci> manastech/crystal#898ee13 (master - Add debug metadata for local variables of integer types): The build passed. https://travis-ci.org/manastech/crystal/builds/80752742
jtarchie has joined #crystal-lang
waj has joined #crystal-lang
<jtarchie> Evening all!
<jtarchie> Was wondering if there was a way to statically compile crystal into a single binary -- similar to how go builds binaries.
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vZj93
<crystal-gh> crystal/master a436169 Ary Borenszweig: Allow newline after parenthesis in attribute
<jtarchie> Probably one of the compile time flags `--define FLAG`.
kulelu88 has quit [Quit: Leaving]
ponga has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vneYi
<crystal-gh> crystal/master a85c746 Ary Borenszweig: Removed unused Libc.time
<crystal-gh> crystal/master 45754c2 Ary Borenszweig: Automatically try to invoke `to_i32`, `to_f32`, etc., when passing types to C functions. Goodbye ugly `LibC::SizeT.new(...)` calls and redundant integer/float suffixes! :-)
<travis-ci> manastech/crystal#45754c2 (master - Automatically try to invoke `to_i32`, `to_f32`, etc., when passing types to C functions. Goodbye ugly `LibC::SizeT.new(...)` calls and redundant integer/float suffixes! :-)): The build passed. https://travis-ci.org/manastech/crystal/builds/80763200
waj_ has quit [Remote host closed the connection]
<crystal-gh> [crystal] technorama opened pull request #1506: Add future {} and lazy {} macros to make concurrency easier. (master...f/future) http://git.io/vnenk
emancu has quit []
lokulin has joined #crystal-lang
lokulin has quit [Changing host]
Neverdie has quit [Quit: http://radiux.io/]
leafybasil has quit [Remote host closed the connection]
benoist has joined #crystal-lang
<benoist> hey guys, had an xcode update and now I'm getting these warnings
<benoist> ld: warning: ld: warning: object file (./.crystal/Users/benoist/.....GroupResult.o) was built for newer OSX version (14.5) than being linked (10.10)
<benoist> any way to fix this?
BlaXpirit has joined #crystal-lang
elia has joined #crystal-lang
<jhass> benoist: we think it's harmless
<jhass> ah, too slow :P
<benoist> Well everything runs, it's just that I cant see my output anymore :)
<jhass> huh?
<benoist> well it's just too cluttered
<jhass> it only happens during linking, no?
<benoist> ah yes that's true
<benoist> just trying to revert cmd tools atm
<benoist> because I can't see the changes in output because my terminal buffer is getting too large
<jhass> 2>/dev/null ?
<jhass> will hide any true linker errors of course
<benoist> and other error messages after linking as well right?
<jhass> if you write them to stderr, sure
<jhass> after linking your binary is invoked
<jhass> could also fun crun() { crystal build $1 -o /tmp/crun 2>/dev/null && /tmp/crun && rm /tmp/crun } I guess
<benoist> ah yes if I built the binary with 2>/dev/null I can run it afterwards without it
<benoist> just can't do crystal run aa.cr
<benoist> but that's not a problem
<benoist> ok thanks for now :)
<jhass> and as said, if you find a way to hide just that particular linker error you have some good chances of getting a patch in ;)
<benoist> haha ok :)
leafybasil has joined #crystal-lang
leafybasil has joined #crystal-lang
benoist has quit [Quit: Page closed]
zamith has joined #crystal-lang
zamith has quit [Client Quit]
nakilon has joined #crystal-lang
pawnbox has joined #crystal-lang
leafybasil has quit [Ping timeout: 240 seconds]
leafybas_ has joined #crystal-lang
Ven has joined #crystal-lang
<BlaXpirit> Are there weak references?
<BlaXpirit> I would particularly like a https://docs.python.org/3/library/weakref.html#weakref.WeakValueDictionary
<jhass> I don't think we have API exposed for it
<jhass> whether bdw-gc has API we could expose, idk
leafybas_ has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
<BlaXpirit> well this is pretty important stuff
elia has quit [Read error: Connection reset by peer]
elia_ has joined #crystal-lang
elia_ has quit [Read error: Connection reset by peer]
elia has joined #crystal-lang
<BlaXpirit> >> a = [1,2,3]; {pointerof(a), Pointer(typeof(a)).new(a.object_id)}
<DeBot> BlaXpirit: # => {Pointer(Array(Int32))@0xbfdec7e0, Pointer(Array(Int32))@0xa024f90} - http://carc.in/#/r/fqp
trapped has joined #crystal-lang
waj has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
elia_ has joined #crystal-lang
elia has quit [Ping timeout: 265 seconds]
waj_ has quit [Remote host closed the connection]
ssvb has quit [Ping timeout: 255 seconds]
waj has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Ven has quit [Read error: No route to host]
Ven has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
BlaXpirit has joined #crystal-lang
jeromegn_ has joined #crystal-lang
jeromegn has quit [Ping timeout: 240 seconds]
jeromegn_ is now known as jeromegn
waj has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
emancu has joined #crystal-lang
<emancu> Hi everyone!
Ven has joined #crystal-lang
<jhass> emancu: hi!
Ven has quit [Read error: Connection reset by peer]
<emancu> i'm using `crystal run file.cr` to compile and run that file
<emancu> with other dependencies..
<emancu> is there any command like `make clean` for crystal ?
<emancu> because i'm getting
<emancu> ld: warning: object file (./.crystal/Users/emancu/Code/crystal/aruba/test.cr/main.o) was built for newer OSX version (15.0) than being linked (10.11)
<jhass> emancu: deleting it probably won't help, but we think it's harmless and safe to ignore, see https://github.com/manastech/crystal/issues/1402
<emancu> it is weird because I was using crystal with El Capitan for a few days without any issue
<emancu> just updated xcode today and get this warnings :/
<emancu> jhass: thx for the link btw
<emancu> jhass: but do you think that a `crystal clear` command will be useless ?
<jhass> fairly
<jhass> rm -Rf .crystal is hardly any harder to type ;)
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vnf4q
<crystal-gh> crystal/master 4435700 Ary Borenszweig: Added to_i and to_f methods to enums so they can be implicitly passed to C
<crystal-gh> crystal/master fe6e509 Ary Borenszweig: Fixed a couple of cases for `String#underscore`
<crystal-gh> crystal/master 7055d1b Ary Borenszweig: Automatically define question methods for each enum member. Goodbye long enum names! (in most cases)
<jhass> asterite: good, now only some magic in def foo(x : SomeEnum); end; foo(:some_enum_member) please :P
<asterite> jhass: we were talking that with waj, but that would be real magic, so for now we won't do it
<asterite> I think the question method was your idea, right?
<jhass> if so I forgot about it already :P
<jhass> but I don't think so
<asterite> Hehehe
<jhass> asterite: btw got a moment to think about my earlier question, about the remaining possible renames?
<asterite> The problem with the magic you propose (but we also discussed it) is that it's hard to do if the symbol is not know at compile time
<asterite> sym = :some_enum_member; foo(sym)
<asterite> should that work?
<jhass> mh, true
<asterite> Or if it's a union of other types
<asterite> Those are the hard or ugly cases that prevent us from doing that
<asterite> waj proposed maybe to pass that as SomeEnum.new(sym)
<asterite> that would switch over the members comparing the symbol... but I think that would be kind of slow, not sure. For literals an optimization can be made
<jhass> another special case solution I see is to start constant lookup inside the enum if and only if the constant is in the call at the right parameter position
<asterite> Yes, that'a another possibility... except that to solve a call we first type the arguments, and then find matching overloads
<jhass> def foo(a, b, x : SomeEnum); end; foo(1, 2, EnumMember) # ok, foo = EnumMember # undefined constant, foo(EnumMember, 1, EnumMember) # undefined constant
<asterite> We must braistorm this a bit more, and give it more time. I think eventually we will arrive at a nice, convenient solution :)
<jhass> yeah
<asterite> I think the question marks will reduce the boilerplate a lot
<jhass> I guess so, yeah
<asterite> because now you will only need the full names when creating these values, but never when you compare them
<asterite> I also found out that this promotes more duck typing, which is really nice :)
<travis-ci> manastech/crystal#7055d1b (master - Automatically define question methods for each enum member. Goodbye long enum names! (in most cases)): The build passed. https://travis-ci.org/manastech/crystal/builds/80830563
<jhass> so what do you think, CharReader -> Char::Reader & PointerAppender -> Pointer::Appender? both are sort of internals, that is you mainly construct them via other API
<jhass> I think we should leave PointerIO for now and StringIO should become SliceIO anyway
<asterite> Yes, sounds good
<asterite> StringIO is different than SliceIO
<asterite> Well, I don't know :)
<asterite> StringIO grows a slice, I imagine SliceIO reads/write from a fixed slice
<asterite> I think waj wanted to rename StringIO to MemoryIO
<jhass> yes they are different, but I think 95% of StringIO's (current) usecases are better done with SliceIO, to the point that I see no point in having StringIO
Ven has joined #crystal-lang
<asterite> because you write bytes... that you can get a String from it is just one use case
<jhass> I pictured SliceIO as regrowing the underlying buffer, similar to Array (sans the shrinking though)
<jhass> I think a fixed sice IO is not really useful, and not what you find in other interfaces anyway
<jhass> just give it an initial capacity if you care about the "no realloc" usecase
<jhass> er, fixed size
BlaXpirit|m has joined #crystal-lang
ssvb has joined #crystal-lang
<BlaXpirit|m> i agree about what was said. i would like just one class named MemoryIO or BytesIO
<BlaXpirit|m> SliceIO would indeed be imagined as fixed size
<jhass> well yeah, we can have it named MemoryIO and then to_s throws out the buffer passed to String.new and to_slice passed through Slice.new
elia has joined #crystal-lang
elia has quit [Read error: Connection reset by peer]
ylluminate has joined #crystal-lang
elia_ has quit [Ping timeout: 244 seconds]
<dzv> asterite: i implemented your suggestion for '@value :: R' and the specs segfault. Is there something i did wrong? Maybe you could quickly look at the diff and tell me why? https://github.com/manastech/crystal/pull/1506
<jhass> dzv: that sounds like @value is read in situations where it wasn't initialized to a value
<jhass> dzv: perhaps in #inspect or #to_s?
<dzv> i don't see how the first is possible. it's read in 1 method after computing the value.
ylluminate has quit [Ping timeout: 240 seconds]
<dzv> overriding to_s and inspect didn't help
<dzv> my simple test case works, it's the spec that segfaults
waj has joined #crystal-lang
<dzv> it's the error case that crashes. odd.
ylluminate has joined #crystal-lang
<dzv> commenting out almost everything it still crashes
BlaXpirit-UA has joined #crystal-lang
<dzv> including error setting and return. even value return
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] jhass opened pull request #1507: Rename CharReader to Char::Reader and PointerAppender to Pointer::Appender (master...rename_reader_appender) http://git.io/vnfKY
BlaXpirit|m has quit [Ping timeout: 256 seconds]
jeromegn_ has joined #crystal-lang
<emancu> Reading the docs I found `Int32 => String` but sometimes ` Int32 -> String`
jeromegn has quit [Ping timeout: 272 seconds]
jeromegn_ is now known as jeromegn
<emancu> one is for `hashes` and the other for `lambdas` , am i right ?
dyulax has joined #crystal-lang
<jhass> emancu: the former is shortcut syntax for Hash(Int32, String), the latter is shortcut syntax for Proc(Int32, String), so yes
<emancu> +1
<emancu> thx
<emancu> jhass: one question about Procs.. it is like Haskell were we can currify them ?
<jhass> nope, no curry, yet at least
<jhass> though I could imagine one could devise an interesting macro that wraps one in a new one
<jhass> dzv: ugh, this smells like a codegen bug
<jhass> valgrind: Unrecognised instruction at address 0x4258940.
<jhass> at 0x4258940: ???
<jhass> by 0x136DD3: *Concurrent::Future(R)::new<&( -> NoReturn)>:NoReturn (in /home/jhass/projects/crystal/code/computation_spec)
<jhass> by 0x110D22: __crystal_main (macro94479680035456.cr:1)
<jhass> by 0x113B3F: main (macro94479669491056.cr:9)
BlaXpirit-UA has quit [Read error: Connection reset by peer]
waj has quit [Ping timeout: 265 seconds]
ylluminate has quit [Ping timeout: 255 seconds]
waj has joined #crystal-lang
<dzv> i backed out that change and changed future from a macro to a function: Assertion failed: (isValidElementType(EltTy) && "Invalid type for pointer element!"), function get, file Type.cpp, line 735.
<dzv> finding tons of bugs today
havenwood has joined #crystal-lang
<asterite> dzv: it's definitely inspect
<asterite> please override inspect in those cases
<asterite> Like Channel#inspect(io)
<jhass> it's not inspect
<dzv> i did override inspect and to_s in Concurrent::Computation
<dzv> nothing changed
<dzv> i also removed all inspect calls
<dzv> by using a small test
<dzv> future { raise "here" }
<dzv> that's enough to trigger the bug
<dzv> sorry, future { raise "here" }.get
<asterite> I see, I'll try to fix it now, should be simple
<asterite> For now you can instead leave @value as nilable, and when you get the value do `value = @value; if value.is_a?(R); value; else; raise "Bug"; end`
<asterite> dzv: can you try and see if that works?
<dzv> yeah, let me back out my change from macro to def that crashes the compiler
<dzv> that works
<asterite> Awesome!
<asterite> Is anyone else also getting random failures in Dir.current_directory? (LibC.getcwd fails with invalid argument)
<jhass> didn't notice so yet
<waj> it happened to me yesterday
<jhass> OS X only perhaps?
<waj> maybe it happens only in mac?
<jhass> ;D
<jhass> if not XFS only I guess
<asterite> Hm, in mac it says: [EINVAL] The size argument is zero.
<asterite> but we are passing nul to buf, size shouldn't matter. And it was always that...
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnfh3
<crystal-gh> crystal/master f4381bd Ary Borenszweig: Make DeclareVar type be nil. Fixes #1508
<asterite> dzv: fixed the issue. Just to check if it works, you can try to see if it compiles fine with the new compiler, using @value :: R. But of course you can't implement it like that until the next version
* nakilon doesn't understand how does RETURN raise make any sense
<dzv> asterite: another bug. see same branch most recent commit
<asterite> nakilon: The fix the commit is about is fixing that. The compiler can't provide "raise" raises because it can't type the string interpolation (because some of its components can't be typed). So in the next release that `return raise` will go back to `raise`. But, as said in a comment, the fix for this isn't completely robust
Neverdie has joined #crystal-lang
waj has quit [Ping timeout: 244 seconds]
waj has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<travis-ci> manastech/crystal#f4381bd (master - Make DeclareVar type be nil. Fixes #1508): The build passed. https://travis-ci.org/manastech/crystal/builds/80848406
waj has quit [Remote host closed the connection]
<asterite> provide -> prove
<jhass> asterite: btw I've been thinking, maybe we should drop bcrypt for now
<jhass> I'm not sure it can be rescued without a rewrite
<BlaXpirit> it could easily be dropped permanently
<asterite> Yes, sure. We accepted it because it was an old pull request and we thought we might be better with it than without it. But if its performance is poor and it has many bugs, we can drop it and wait for a better replacement
<asterite> (and be more rigurous with next pull requests, that was waj and mine mistake)
apt-get has joined #crystal-lang
<dzv> i suggest you only accept something that uses bcrypt.c
Ven has quit [Ping timeout: 246 seconds]
<dzv> crypto implementations are hard to get right
waj has joined #crystal-lang
<waj> dzv: what's bcrypt.c ?
<dzv> the c implementation used in openbsd
shama has joined #crystal-lang
<dzv> i'm pretty sure that's what the ruby and python implementations use
leafybasil has quit [Remote host closed the connection]
<waj> I cannot find it preinstalled in mac and I don't see it as homebrew package either
<waj> so do you suggest we include bcrypt.c in crystal sources?
<dzv> yes. as a packaged library it doesn't exist. some systems builting crypt() implmentations support bcrypt transparently
<waj> I see
<waj> seems like ruby doesn't include bcrypt
<waj> there is a gem: https://rubygems.org/gems/bcrypt
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnJuY
<crystal-gh> crystal/master b86a5b8 Ary Borenszweig: `crystal deps` now delegates to `shards` (eventually shards will be distributed with the compiler). Removed all Projectfile related logic. Updated `crystal init` to use shards.
<dzv> the python implementation uses bcrypt.c
<waj> it uses bcrypt.c for mri
<waj> but pure ruby (python) implementation would be really slow
<waj> they use pure java for jruby anyway
<waj> shouldn't be that hard :)
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnJu2
<crystal-gh> crystal/master 41b36ea Ary Borenszweig: Removed a couple of references to Projectfile in comments
<dzv> waj: changing macro future to def future caused a compiler error
<waj> farewell Projectfile!!!
<waj> and... against all my wishes, crystal libraries are officially named "shards" :P
<asterite> :-P
<asterite> dzv: what error?
<BlaXpirit> waj, what does this mean? shards part of crystal now?
<jokke> hey
<dzv> Assertion failed: (isValidElementType(EltTy) && "Invalid type for pointer element!"), function get, file Type.cpp, li
<waj> BlaXpirit: not yet
<asterite> dzv: try to reduce it
<jokke> anyone care to help contribute to a project to be something like https://github.com/solnic/virtus for crystal?
<dzv> i have: future { 42 }.get
<jokke> i've started with something as a part of another project but i think it's very universally usable
<dzv> also, also fails: p (future { 42 })
<travis-ci> manastech/crystal#b86a5b8 (master - `crystal deps` now delegates to `shards` (eventually shards will be distributed with the compiler). Removed all Projectfile related logic. Updated `crystal init` to use shards.): The build passed. https://travis-ci.org/manastech/crystal/builds/80864173
<jokke> crystal macros seem to allow doing something like virtus and it's very cool since all field definitions are naturally generated on compile time
<dzv> also fails: p Future.new(&block) within 'def future' but diff error: undefined method 'inspect' for Void (compile-time type is (Nil | Void))
<jokke> i'd like to create a repo on github but can't think of a name for the project :D
<dzv> success: p Concurrent::Future.new { 42 }
<jokke> "Model" would be a bit too general for my taste :P
<dzv> so why would the same code work when used directly but fail inside: 'def future(&block); ... ; end'
tdc has joined #crystal-lang
tdc has quit [Client Quit]
<jeromegn> jokke: what would be the advantage of a lib like that vs. adding a bunch of `property` in your class and using a initialize method with named arguments which are casted to the correct type?
<jokke> jeromegn: validators and convenience
<jokke> i'll give you an example
<travis-ci> manastech/crystal#41b36ea (master - Removed a couple of references to Projectfile in comments): The build passed. https://travis-ci.org/manastech/crystal/builds/80864383
<jokke> the block in the field macro is used for providing a default value if it's missing
<jeromegn> interesting
<jeromegn> a bit verbose
<dzv> i have a test case for one of the errors: http://carc.in/#/r/frn
<jokke> jeromegn: after a further macro for single line default definitions: https://p.jreinert.com/Av3J/ruby
<dzv> waj: asterite: ^^^
<dzv> test case
<jokke> jeromegn: the default an be left out in which case a | ::Nil is added to the given type
<jokke> one question: do _all_ standard objects have a copy constructor?
<jokke> *classes
<jokke> this would be very very useful for my model lib
<jokke> in this case use {{Type}}.new({{value}}) as a setter macro
<jokke> ah
<jokke> no i couldn't
<jokke> not with unions
qard has joined #crystal-lang
<asterite> dzv: you can't inspect void. I thought that case was for the compiler bug
<jokke> whoa
<jokke> i just noticed {% %} can be used outside macro definitions
<jokke> that's neat
<dzv> asterite: why is it void?. change "c { }.p" to "p C.new { }" and it works. why does the single function definition change the return? updated: http://carc.in/#/r/frp
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vnJF9
<crystal-gh> crystal/master a379d79 Ary Borenszweig: Fixed typo in init spec
<jhass> if you don't specify a restriction it defaults to (->)
kulelu88 has joined #crystal-lang
Ven has joined #crystal-lang
Neverdie has quit [Quit: http://radiux.io/]
Ven has quit [Read error: No route to host]
leafybasil has joined #crystal-lang
<travis-ci> manastech/crystal#a379d79 (master - Fixed typo in init spec): The build passed. https://travis-ci.org/manastech/crystal/builds/80873814
leafybasil has quit [Ping timeout: 264 seconds]
Neverdie has joined #crystal-lang
<jokke> is there a way to let the arguments to a macro to be generated at compile time?
<jokke> uh never mind
<jokke> that's what macro methods are for
waj has quit [Ping timeout: 240 seconds]
<jokke> oh
<jokke> no
<jokke> it doesn't work
waj has joined #crystal-lang
havenwood has joined #crystal-lang
<dzv> jhass: still having trouble with block types http://carc.in/#/r/frx
<BlaXpirit> dzv, what's Cc
<jhass> Foo
<BlaXpirit> oh wait, I thought it was meant to be a generic, but there is acttually such a class
<dzv> was called C but it was recognized by a type (like R) in 1 iteration. had to change it
<jhass> http://carc.in/#/r/fs7 mmh, I'd expect that to work
<dzv> i also tried that. is there no way to make it work?
<jhass> I don't find any currently
<jokke> is it somehow possible to have somekind of namespaces for macros inside a module
<jokke> so that one could do sth like namespace do
<jokke> and only inside this namespace certain macros could be used
<jhass> jokke: I guess you could define them in a module and add a toplevel macro that wraps the passed block into it
<jokke> ah
<jokke> yeah
<jhass> dzv: what do you need the yield the future for?
ponga has quit [Quit: Connection closed for inactivity]
<jhass> jokke: also calling macros on modules became possible recently
<dzv> cancellation and chaining
<jokke> oh ok
<jokke> jhass: this does not work: https://p.jreinert.com/pbP/ruby
<jhass> dzv: maybe a promise/future pattern could work? that is have two connected classes, a Future that allows to retrieve a value and a promise that allows to fulfill it? So you'd only hand out the future to users
<jhass> jokke: it was a guess
<jokke> :)
<jokke> alright
<dzv> jhass: hmm. that may be better
<jhass> dzv: though apparently you can't use freevars in Proc arguments, so it has the same problem when I think about it
<asterite> dzv: I don't understand, why don't you do `def future(&block : -> R); Concurrent::Future(R).new(block); end`
<dzv> will that work with @block.call(self) ?
waj has quit [Ping timeout: 246 seconds]
<asterite> There's no self in the pull request you sent
waj has joined #crystal-lang
<dzv> i'm refactoring
<jhass> asterite: being able to yield self to a proc you store in a generic class does sound like it could be useful elsewhere, I wonder if there's a way
<crystal-gh> [crystal] bcardiff opened pull request #1510: Allow HTTP::Response created with a body_io to be sent as chunked (master...http-server-chunked-response) http://git.io/vnUVu
<jhass> dzv: I guess a conceptual issue is yielding something that depends on the return type to the thing producing the return type. Eg what would future {|f| f.get } do
<dzv> jhass: wait forever
<asterite> jhass: that's exactly the issue, it's a recursive dependency
<dzv> i thought recursive data structures were allowed (JSON)
<jhass> dzv: no, not on the runtime level, on the type level
<jhass> json is a recursive union, not a recursive generic
<dzv> code is data. data is code
<jhass> I take that as a "I have no idea either" ;)
<dzv> jhass: homoiconicity
<jhass> crystal is far away from being lisp ;)
<dzv> future {|f| f.get } would block forever because it would wait on a channel it is supposed to fill. if another fiber cancels it the exception should be handled as usual
<jhass> I'm not asking what it should do
<jhass> I'm asking what type the proc would return
<dzv> yes, i see. it's 9 hours past my bed time, sorry for being slow.
<jhass> no worries, maybe sleep over it and we can find a way to do chaining without yielding self
<jhass> btw do you know a compiled language that's homoiconic? The ones Wikipedia lists all seem to be interpreted, have a VM or a JIT
<trapped> is the short syntax for regex replace (/old/new/options) a thing?
<jhass> nope
<dzv> the future branch is updated. i have a solution that i'll work on later. next PR so i don't upset asterite
<asterite> jhass: there's a way, use a proc literal and specify the types
<jhass> asterite: well with the added constraint of the generics type being inferred from the procs return type I guess ;)
<jhass> but that has the recursive type property as I realized after, so nvm
<asterite> jhass: I think it's only an issue with generic types, if it's a regular type you'd know it so you can do Foo -> R
<jhass> yeah
qard has quit [Ping timeout: 244 seconds]
qard_ has joined #crystal-lang
<trapped> why can't Float64s be casted to Float32? (the compiler seems to assume floats are 64bits, probably because i'm on x64, even when i'm passing literals to a function that has an explicit Float32 sig)
<trapped> using e.g. `13.55 as Float32` doesn't seem to work (can't cast)
<jhass> because you want to convert them actually, call to_f32
<trapped> hmmm
<jhass> never had to do IEEE idk conversion by pencil and paper, heh? :P
<trapped> is that considered right? since (code-wise) it's not exactly a conversion
<trapped> or it shouldn't be, at least
<trapped> i think
<jhass> if you can achieve conversion by reinterpretation of the same bytes, that does not make it any less conversion, it's just an implementation detail of the conversion
<jhass> your intent is "I want a Float32 representation of that value", that intent is conversion
<trapped> my intent would've been more like "i want to tell the compiler that what i'm passing is actually a Float32 literal, so it should parse it as such"
<jhass> >> 3.124f32
<DeBot> jhass: # => 3.124 - http://carc.in/#/r/fu3
<jhass> that's a Float32 literal just for you
<trapped> ah well that solves the problem then
<trapped> thanks
waj has quit [Ping timeout: 264 seconds]
waj has joined #crystal-lang
<trapped> thanks
<jhass> yw
Neverdie has quit [Quit: http://radiux.io/]
<trapped> jhass: that second thanks was actually me alt-tabbing then pressing up and enter but i do mean it anyway
<trapped> by accident*
<asterite> dzv: hahaha, you don't upset me, I just think we should be more organized and do things in small steps
<asterite> dzv: the only issue is that here in Buenos Aires it never snows (well, it snowed several years ago, but it was a really poor snow), so a cancelled future would be very confusing for an argentinian programmer
<dzv> i think we have a different definition of small. to me that PR is small
<asterite> If the original PR had future, lazy and delay, it would be OK. What I "dislike" is that the PR grows
<asterite> In any case, we like the final result :-)
<asterite> but what about the snow?
<dzv> this is the first PR in a series to stop global warming
<dzv> small steps right?
<jhass> aw, but I like it warm
<dzv> move to argentina
<jhass> dunno, too many nazis did back then it might feel odd :P
<jeromegn> hah
<dzv> are there any plans for c++ support (calling in to c++ libs)?
<jhass> how would you approach that? automatically generated C wrappers?
<BlaXpirit> jhass, no, direct support is definitely possible
<BlaXpirit> Nim has it
<dzv> i thought name mangling was standardized a few years ago
<jhass> BlaXpirit: huh, I thought it's basically impossible since the mangling is undefined and may change with like every compiler version, not to speak of between compilers
<dzv> maybe i'm wrong and thinking of a specific compiler that changed to be compatible with another
<dzv> i see. but something was made more compatible a few years ago. oh well. autogenerated c wrappers or whatever nim uses
<BlaXpirit> i don't think it's possible to generate C wrappers automatically
<asterite> it was pretty cold these last months in Buenos Aires. We get very hot and also cold weather here (probably not that cold compared to some other countries)
<jhass> asterite: what's pretty cold in celsius? :P
<dyulax> did you feel the earthquake yesterday?
<trapped> is there any way to more easily use `crystal tool browser`? (i.e. class by name)
apt-get has quit [Ping timeout: 250 seconds]
<asterite> jhass: I think once it went below zero
<asterite> so I guess that isn't very cold
<wmoxam> asterite: !!
<wmoxam> sounds cold for Buenos Aires
<jhass> mmh, yeah I guess we regularly drop below here
<asterite> Lowest was -5,4 °C in 1918, it seems
<jhass> looks like we got to -37,8 °C in 1929 :D
<ytti> in finland temperature range covers some 80c
<ytti> in siberia >100c
<jhass> but the lowest month average is just -0,5, so that was extreme too
<trapped> how much do you pay for a pizza in germany
<ytti> now staying in cyprus, and here tempearature range is less than 40c
<jhass> trapped: uh, restaurant, delivery, discounter?
<trapped> restaurant and delivery
<ytti> i'm guessing restaurant is anything from 5eur to 50eur :)
<jhass> mmh, I guess the averages are around 6-9 € for the basic ones
<trapped> how big?
<jhass> eh, idk 25-30cm I guess
<jhass> also depends on italian vs american style and what not
<jhass> the range is quite high really
<trapped> here a 50cm-wide margherita is about 4eur (excluding other expenses like delivery or table fee)
<trapped> i was thinking of visiting berlin and try either ayahuasca or peyote but i don't wanna spend too much on food
<trapped> when i visited amsterdam i spent 150eur in 3 days in food alone
<dyulax> is there ayahuasca in germany?
<trapped> dyulax: you can find ayahuasca pretty much everywhere if you know where to ask
<trapped> same goes with almost every drug
<dyulax> that's crazy... even here in Brazil a lot of people never took
<trapped> jhass: what about kebab?
<jhass> 3.50
<dyulax> but it's really hard to acquire, you can't buy it, only some religious centers are authorized to distribute it (freely)
<jhass> everything below is garbage and will get you food poisoning
<trapped> dyulax: where i live, more than 70% of the population consumes cannabis regularily, yet they haven't legalized (and taxed) it yet
<dyulax> trapped: where do you live?
<trapped> jhass: i heard doner is actually a german franchise company, is that true?
<trapped> dyulax: italy
<trapped> dyulax: you might also be surprised to hear that a considerable chunk of the population consumes cocaine regularily
<jhass> trapped: haven't heard of it. The origin of putting it into the bread so you can like run around with is from berlin though
<jhass> in turkey you largely only get it on the plate still
<dyulax> trapped: is it true your pizza don't have a wide range of flavors? like ice-cream, chocolate, corn, and other exquisite ones?
apt-get has joined #crystal-lang
<trapped> dyulax: you even just mentioning those "flavors" as you non-italian pizza consumers call them makes my heart hurt
<trapped> although i admit some places make pizza with nutella
<trapped> but that's basically bread with nutella on top
<dyulax> hahahah
<trapped> and nutella is italian anyway
<jhass> Super creme!
<jhass> let's stay true to the origins!
<trapped> honestly i haven't even ever tried pizza with any of those unusual toppings
<BlaXpirit> doh, jhass, dzv, it finally dawned on me how Nim does it
<jhass> I think someone here did currywurst pizza
<trapped> it's just something that it's not done here, probably because you can get fined for calling pizza what is actually not specified in the UNESCO recipe
<BlaXpirit> Nim compiles to C or C++, so yeah.......
<dyulax> here in Brazil all "pizzerias" have like 30 different flavors of pizza
<dyulax> it's pretty common, anywhere
<jhass> BlaXpirit: :D
<BlaXpirit> so it's probably not reasonably doable after all
<jhass> http://koch-werkstatt.de/wp-content/uploads/2010/03/pizza-cp.jpg germans are so disgusting sometimes :D
<trapped> heartbreaking pictures
<trapped> anyway it's not like there aren't many pizza flavors, it's just that only so many are popular enough to "go global"
<jokke> i'm trying to include only methods and methods generated by macros but _not_ the macros that generated them from a module.
<jokke> i tried the following: https://p.jreinert.com/yUJ/crystal
<jokke> i tried the following: https://p.jreinert.com/yUJ/ruby
<jokke> and used it like this: include Model; fields do ... end
<jokke> the including class wont have the instance methods from the module though
BlaXpirit|m has joined #crystal-lang
BlaXpirit|m has quit [Client Quit]
<asterite> jhass: what was the talk that explained monads with ruby? I want to explain it to waj but already forgot their exact meaning
<asterite> Mmm... lmgtfy, nevermind :(
BlaXpirit|m has joined #crystal-lang
BlaXpirit|m has quit [Remote host closed the connection]
elia has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
<jokke> jhass: asterite can you please explain to me how exactly macros are expanded? Especially in which order
BlaXpirit|m has joined #crystal-lang
<jokke> if i understand correctly macros are only expanded when used (except for macro methods)
BlaXpirit|m has quit [Client Quit]
elia has quit [Quit: Computer has gone to sleep.]
<jokke> why is assigning not allowed for macro instance vars?
BlaXpirit|m has joined #crystal-lang
<jokke> this is what i'm trying to accomplish: https://p.jreinert.com/jrOCu/ruby
<jokke> i cannot use a constant instead of @fields, when the fields macro would be used in another class FIELDS would still contain all fields from the class befoer
<jokke> *before
waj has quit [Remote host closed the connection]
leafybasil has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
BlaXpirit|m has quit [Quit: AndChat]
elia has joined #crystal-lang
Neverdie has joined #crystal-lang
havenwood has quit [Ping timeout: 250 seconds]
havenwood has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
BlaXpirit has joined #crystal-lang
BlaXpirit has quit [Client Quit]
<trapped> how come i'm getting "undefined method 'length' for Array(String)"
<trapped> on last commit
apt-get has quit [Quit: Quit]
<jhass> we renamed everything to size
<trapped> ah
<trapped> the API docs must be outdated then
<trapped> what about TimeFormat
<trapped> where did it go
<jhass> yes the reflect the current release
<jhass> Time::Format
<jhass> *they
<trapped> alright
<trapped> hmm
<trapped> it seems the `trying to downcast TCPSocket+ <- TCPSocket` thing is back
<jhass> huh
<jhass> how do you produce it?
<trapped> i wish i knew
<jhass> you sure you recompiled the HEAD compiler?
<trapped> yes
<trapped> i compiled it twice
<jhass> and using it together with the current stdlib?
<trapped> i.. think?
<trapped> can you go over that last part
<jhass> well, like you don't combine it with the release stdlib or the release compiler with the HEAD stdlib
<trapped> does the LIBRARY_PATH thing have something to do with that
<jhass> no, that's just for the linker
<trapped> i assumed they were statically linked in the crystal executable
<trapped> i just periodically git pull the repo then run `make -B`
<trapped> with the library path thing in env
<trapped> then use the bin/crystal script
<jhass> well, idk
<trapped> hmm
<jhass> if you can reduce it report an issue
<trapped> i'll try to but i'm still trying to figure out the other one
<trapped> even though i think some commits ago it might have been fixed
<trapped> is projectfile unused now too?
<jhass> yes, crystal deps delegates to shards now
<trapped> yeah i was already using it but now that it's the default i guess its repository is gonna be a bit more populated
<trapped> are shards `require`'d differently (or automatically)? i was requiring crystal-mime as `require "mime"` but it doesn't seem to work anymore
<trapped> it seems i don't have to require it anymore
<trapped> no, i actually have
<trapped> hmmm
<trapped> gonna leave this for tomorrow and go sleep
trapped has quit [Read error: Connection reset by peer]
elia has quit [Quit: Computer has gone to sleep.]
qard_ has quit [Ping timeout: 250 seconds]
havenwood has quit [Ping timeout: 255 seconds]