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
<travis-ci> manastech/crystal#c2255c0 (master - Make Time.epoch always return UTC times. Fixes #1210): The build passed. https://travis-ci.org/manastech/crystal/builds/76201067
<crystal-gh> [crystal] asterite closed pull request #1221: typeof: add type flattening example (gh-pages...doc-typeof) http://git.io/vsItM
n0xff has joined #crystal-lang
waj has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
ssvb has quit [Ping timeout: 240 seconds]
waj has quit [Remote host closed the connection]
sailorswift has joined #crystal-lang
shama has quit [Remote host closed the connection]
kyrylo has quit [Ping timeout: 256 seconds]
shama has joined #crystal-lang
n0xff has quit [Ping timeout: 244 seconds]
n0xff has joined #crystal-lang
shama has quit [Remote host closed the connection]
n0xff has quit [Ping timeout: 246 seconds]
n0xff has joined #crystal-lang
shama has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kulelu88 has quit [Quit: Leaving]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
BlaXpirit has joined #crystal-lang
havenwood has quit [Ping timeout: 260 seconds]
<BlaXpirit> Array.pop seems strange to me
<BlaXpirit> .pop discards one item and .pop(1) returns a copy without the last item
<BlaXpirit> oh no, i was confused
<BlaXpirit> it does modify the original array, but also returns an array of popped items
sleeper_ is now known as sleeper
BloodyHi_ has joined #crystal-lang
BloodyHi_ has quit [Client Quit]
sailorswift has joined #crystal-lang
Ven has joined #crystal-lang
ssvb has joined #crystal-lang
kyrylo has joined #crystal-lang
BlaXpirit_ has joined #crystal-lang
<BlaXpirit_> Benchmark.bm gives some strange results like 0.000076 0.000000 0.000076 ( 0.056363)
<BlaXpirit_> what could this mean?
<jhass> user system total (real)
<BlaXpirit_> yes, jhass, but why is real so much higher
<jhass> because the kernel decided to give your program no CPU time for that time
<jhass> generally .ips produces more reliable benchmarks
<BlaXpirit_> jhass, i want multiple benchmarks for multiple classes
<BlaXpirit_> the table seemed real convenient
<jhass> ips can do that just fine
<BlaXpirit_> oh also, what about an array insert getting slower and slower?
<BlaXpirit_> ips just gonna give an average, i suppose
<jhass> resizing bigger buffers is slower?
<BlaXpirit_> jhass, uh no, it needs to shift every item to the right
<BlaXpirit_> + check this out, jhass carc.in/#/r/bz8
<jhass> Benchmark.ips do |x| x.report("ClassA") { ClassA.op }; x.report("ClassB") { ClassB.op }
<BlaXpirit_> what's wrong with that code?
<jhass> prolly just the sandbox
<BlaXpirit_> jhass, no, im getting the same locally
<BlaXpirit_> (although i am doing it through SSH...)
<jhass> idk
<BlaXpirit_> ips is really not applicable here. i don't want warmup and i want an exact number of iterations
<BlaXpirit_> bm is great but the first 3 numbers make no sense
<BlaXpirit_> is it not possible to use 2 classes with the same name from two different libs?
Ven has quit [Ping timeout: 246 seconds]
<jhass> not really no, there's only one global namespace
<BlaXpirit_> mm, wrapping the require into module worked :o
<jhass> yes, but we will likely drop that
<BlaXpirit_> D:
<BlaXpirit_> that would suck
<jhass> no, the current feature sucks and is confusing
<vegai> mm, crystal has ternaries?
<jhass> sure
<vegai> isn't that kinda redundant when ruby-like single-line if statements exist
<jhass> they don't really
<jhass> no then
<jhass> and ; is cheating :P
<vegai> I mean this form
<vegai> >> "foo" if 1 > 0 else "bar"
<DeBot> vegai: Syntax error in eval:4: 'else' is useless without 'rescue' - http://carc.in/#/r/bzb
<vegai> ah, I see :P
<BlaXpirit_> thats python
<jhass> that's not valid Ruby either
<vegai> >> "foo" if 1 > 0
<DeBot> vegai: # => "foo" - http://carc.in/#/r/bzc
<vegai> right, ok then
<jhass> BlaXpirit_: say you have a library foo, depending on the library bar and thus doing require "bar" (at the toplevel) and Bar::Baz.new, now in your app you do module Quux; require "bar"; end; require "foo"; What will happen? load the code twice? try to rewrite all references to Bar to Quux::Bar? currently it does neither, it breaks. Renamspacing just doesn't work with a global loading system
<BlaXpirit_> jhass, ok :p
<BlaXpirit_> i mean, i had thoughts like this
<BlaXpirit_> but for my particular usecase i have no alternative
<BlaXpirit_> doing something like this https://bpaste.net/show/f92f6d236f77
<jhass> well, you could just rename yours for the test
<jhass> but yeah, as a good citizen Crystalline should namespace
<BlaXpirit_> Crystalline is low quality from what i've seen :(
<BlaXpirit_> i'm writing this Deque hoping that one day it will get into stdlib
<BlaXpirit_> i based the on Crystal's Array
<jhass> please with the minimal usecase specific API then
<BlaXpirit_> if I were to release this as a separate lib, which is my initial plan,
<jhass> I hate the Java situation where you're always confused what to use now
<BlaXpirit_> how do i deal with licensing?
<jhass> slap a LICENSE into the repo?
<BlaXpirit_> crystal is under Apache license
<jhass> yeah
<jhass> so?
<BlaXpirit_> i have no idea how to deal with it. it's a complex license
<jhass> it's not, it's MIT + patent waiver
<BlaXpirit_> except mit is a few lines and that one is huge
<jhass> that's all just the patent waiver
<BlaXpirit_> so how do i give credit properly?
<BlaXpirit_> i guess this is offtopic, but there should be an FAQ somewhere anyway, because i'm not gonna be the only one facing this
<jhass> I think MIT/Apache is permissive enough that derivative work you can just relicense as whatever. And in practice nobody will say anything anyway, some "Based on" comment is more than enough for most
BlaXpirit_ has quit [Quit: Konversation]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vsqhf
<crystal-gh> crystal/master b8f3235 Ary Borenszweig: Fixed #1209: Buffer overflow after Array.new(size, value) with size < 3
<BlaXpirit> hmmmmmmm, is it not possible to pass a code block to a macro?
<dzv> i have a possible compiler issue. in ./src/process/run.cr:105: undefined method 'each' for Nil:Class. but the line includes not_nil!. env.not_nil!.each do |key, val|
<jhass> BlaXpirit: it is, you can access it with {{yield}}
<BlaXpirit> I didn't know that and it is not in the docs :(
<BlaXpirit> thanksa
<jhass> dzv: env = nil : Env, not env = Env
<jhass> note the error is undefined method for Nil:Class, not Nil
<dzv> how did you find that so quickly?
<dzv> oh
<dzv> i have another elsewhere
<dzv> crystal: Instructions.cpp:1085: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
juancate has quit [Ping timeout: 246 seconds]
<jhass> sounds like a compiler bug
<dzv> try running spec/std/socket_spec.cr
juancate has joined #crystal-lang
<dzv> i get these errors a lot when adding debug statements or using nested blocks. moving the blocks to methods sometimes helps
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<travis-ci> manastech/crystal#b8f3235 (master - Fixed #1209: Buffer overflow after Array.new(size, value) with size < 3): The build passed. https://travis-ci.org/manastech/crystal/builds/76256606
<jhass> dzv: actually passes here
<jhass> dzv: do you use the bin/crystal ?
<jhass> and a compiler from the master branch?
<jhass> I get a couple failed nil assertions on make spec
<jhass> in the run macro?
<dzv> yes i'm using bin/crystal. i get sent previously. using linux
<dzv> i just recompiled using master to be sure
<dzv> my code is not finished and i expect random spec failures but not compiler errors
<dzv> what is the preferred llvm version?
<BlaXpirit> dzv, 3.5 is the earliest supported version, don't know if there is any difference otherwise
<dzv> i'm using 3.5
<jhass> I'm on 3.6
<BlaXpirit> i'm on 3.4 with hacks to make 3.6 the default :|
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vsmsT
<crystal-gh> crystal/master afac300 Ary Borenszweig: Fixed #1229: StringIO index out of range when reading more than available
<travis-ci> manastech/crystal#afac300 (master - Fixed #1229: StringIO index out of range when reading more than available): The build passed. https://travis-ci.org/manastech/crystal/builds/76261892
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 246 seconds]
<dzv> is multiple return without a return statement allowed? http://carc.in/#/r/bzw
<jhass> you just proved it isn't? ;) use {1, 2}
<dzv> that seems inconsistent with https://github.com/manastech/crystal/issues/105
<dzv> a, b = f(returning tuple) is automatically destructured but map or other lambdas aren't
<jhass> not really
<jhass> assignment and argument lists are quite different things
<jhass> it'd be nice to have tuple destructuring in parameter lists too, but I don't agree that it's a consistency thing
<dzv> also return 1,2 is allowed but removing the return statement isn't. that also means i can't use case/if/blocks/etc without explicitly specifying tuples with {}
<jhass> >> def foo; return 1, 2; end; f
<DeBot> jhass: Error in line 4: undefined local variable or method 'f' - http://carc.in/#/r/bzz
<jhass> >> def foo; return 1, 2; end; foo
<DeBot> jhass: # => {1, 2} - http://carc.in/#/r/c00
zamith has joined #crystal-lang
<BlaXpirit> hm why is this allowed, indeed?
<dzv> from a logical perspective it seems inconsistent. the rules change depending on if it's a return value or arguments seemingly without reason
<BlaXpirit> >> def foo; yield 1, 2; end; foo {}
<DeBot> BlaXpirit: # => nil - http://carc.in/#/r/c01
<BlaXpirit> with yield this seems like a wanted feature
<BlaXpirit> yield, return, break etc they all share this possibility
<BlaXpirit> but just writing comma-separated values is not a valid expression so whatever
zamith has quit [Client Quit]
<jhass> yield is closer to a method/function call than to a return statement IMO
<BlaXpirit> jhass, what about break?
<jhass> break and next are like return
<BlaXpirit> >> def foo; yield 1, 2; break 1, 2; end; foo {}
<DeBot> BlaXpirit: in line 4: Invalid break - http://carc.in/#/r/c02
<BlaXpirit> right... i'm still confused on this topic
<jhass> I mean if we're comparing semantics
<BlaXpirit> >> def foo; yield 1, 2; loop do; break 1, 2; end; end; foo {}
<DeBot> BlaXpirit: # => {1, 2} - http://carc.in/#/r/c03
<jhass> return returns from the method defining a block, break returns from the method invoking a block and next returns from the block
<BlaXpirit> it would also make sense to allow this bracketless thing just with yield
<BlaXpirit> jhass's point is clear
<BlaXpirit> but this is just bikeshedding
<jhass> return 1, 2 == return {1, 2} but yield 1, 2 != yield {1, 2}
<BlaXpirit> what i definitely don't see happening is allowing bare a, b at the end of a method
<BlaXpirit> oh really, jhass?
<jhass> yes
<BlaXpirit> that's even worse
<BlaXpirit> ok, i definitely dislike these assumed brackets now
<jhass> if we have auto destructing in do |a, b| so that yield 1, 2 and yield {1, 2} results in the same callee semantic it's okay IMO, it's what Ruby does
<BlaXpirit> i think current behavior of yield is good
<BlaXpirit> i wouldn't want to be unable to pass a tuple!
<jhass> it's what makes Enumerable incompatible with Hash
<jhass> you still can
<jhass> def foo; yield {1, 2}; end; foo {|a| a == {1, 2} }; foo {|a, b| a == 1, b == 2 }
<jhass> that'd be the behavior with automatic destructuring
<jhass> the alternative proposal is to have explicit destructuring: def foo; yield {1, 2}; end; foo {|(a, b)| a == 1, b == 2 }; foo {|a, b| a == {1, 2}; b == nil }
<BlaXpirit> reminds me of Python
<jhass> which would result in Hash#each do be hash.each do |(k, v)| to make it compatible with Enumerable
<BlaXpirit> but Python actually dropped this feature
<BlaXpirit> (destructuring in function arguments)
<BlaXpirit> took me a long time to understand what you mean
<BlaXpirit> sure, this can make sense, but too much code would break
<crystal-gh> [crystal] technorama opened pull request #1231: Process.run bugfixes and enhancements: (master...f/close_on_exec) http://git.io/vsmXc
<dzv> version 1 hasn't been released. it's a lot easier to break code now.
waj has joined #crystal-lang
<jhass> dzv: btw did you notice that your git config user.email isn't set to one associated with your Github account?
<dzv> i don't care
<jhass> having commits in popular OS projects can get jobs ;P
<dzv> it only gets me recruiter/webhosting spam and other junk
<dzv> i'd like to work with crystal but i don't think there are any jobs yet
Ven has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vsm9H
<crystal-gh> crystal/master 4354a7d Ary Borenszweig: Fixed a bug where a union restriction wouldn't restrict a union of generic instances
leafybasil has joined #crystal-lang
<travis-ci> manastech/crystal#4354a7d (master - Fixed a bug where a union restriction wouldn't restrict a union of generic instances): The build passed. https://travis-ci.org/manastech/crystal/builds/76273506
blue_deref has joined #crystal-lang
Rishav has joined #crystal-lang
<Rishav> hi
<Rishav> does crystal have any unit testing framework in the stdlib?
<dzv> require "spec". see the spec directory for examples
<Rishav> thanks
waj has quit [Remote host closed the connection]
havenwood has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Rishav has quit [Quit: Page closed]
Ven has joined #crystal-lang
strcmp1 has joined #crystal-lang
<grindhold_> j
<jhass> k
<strcmp1> u jokers
waj has joined #crystal-lang
waj has quit [Remote host closed the connection]
waj has joined #crystal-lang
zamith has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
zamith has joined #crystal-lang
<Netfeed> if i want to send a class as an argument and then call new on that class, then all i need to do is: def foo(bar : String.class); bar.new; end; foo(String), right? i'm not missing anything here?
<strcmp1> it should only be the String class?
<Netfeed> example class in this case
blue_deref has quit [Quit: bbn]
<Netfeed> i think i've found a bug in the sqlite3 module
<Netfeed> might be that i've missunderstood something and written shitty code though
<BlaXpirit> Netfeed, what u wrote 25 minutes ago is good
<Netfeed> thought that was a part of the bug
<BlaXpirit> (well, it works only in simple cases, generics aren't implemented like that)
<BlaXpirit> >> 5 as Int
<DeBot> BlaXpirit: in /usr/lib/crystal/int.cr:295: instantiating 'Int#abs()' - http://carc.in/#/r/c0r
<Netfeed> here, the sql needed is in the begining, very simple example, the out commented code works, the one that isn't doesn't, if you run "http://localhost:8080" twice, then you'll get an out of memory exception
<Netfeed> but if you remove the t.update call, then it's fine
<BlaXpirit> ok, Netfeed, seems to work here
<Netfeed> you don't get an exception after two "curl http://localhost:8080"?
<BlaXpirit> no, Netfeed
<jhass> mmh, I do
<jhass> but not if I try to take out HTTP::Server
<BlaXpirit> i actually replaced the database with :memory:
<BlaXpirit> :memory: works
<BlaXpirit> and in-file database fails just the same
<BlaXpirit> as you
<Netfeed> i get the same error with: http://pastebin.com/4tPBrXQB
<BlaXpirit> uh what changed?
<Netfeed> no http
<BlaXpirit> ah 2 times
<BlaXpirit> good thing that u ruled it out
<Netfeed> works fine when i manually close the statement though
<BlaXpirit> well, Netfeed, you're closing db 2 times
<Netfeed> yes, and i'm connecting to it twice too
<Netfeed> as far as i understand it
<jhass> BlaXpirit means in the if t and in the ensure
<BlaXpirit> removing it doesnt help
<Netfeed> oh, right
<Netfeed> yeah, same thing
<jhass> the second .update triggers it
<jhass> though running update twice on the same connection doesn't
<BlaXpirit> what the heck
<BlaXpirit> i cannot make the example any smaller https://bpaste.net/show/8d9559860a9a
<Netfeed> but that doesn't really work if i have a webserver though? then i need a database connection per http connection
<BlaXpirit> Netfeed, nono, there is definitely something wrong here, it's not you
<Netfeed> for once :P
<BlaXpirit> maybe it's the return!!!
<BlaXpirit> jhass, it's the return that breaks it
<BlaXpirit> returns without closing or something
<jhass> yeah
<jhass> I think http://paste.mrzyx.de/p9yg17kgu fixes it
<jhass> <3 monkey patching :P
<BlaXpirit> <3
<jhass> any of you less lazy than me and want to PR? :P
<BlaXpirit> no u do it
<Netfeed> yeah, that fixed it
<jhass> but writing a spec for that sounds annoying...
<BlaXpirit> it's not a requirement
<jhass> for me it pretty much is
<BlaXpirit> just do this change and it will make the world a better place
<jhass> personal standards :P
<BlaXpirit> jhass, worst thing is error doesnt trigger for in-memory database
<Netfeed> thanks for the help
<Netfeed> this means though that i actually must start building stuff now when things actually work :P
shama has joined #crystal-lang
blue_deref has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zamith has quit [Quit: Be back later ...]
Ven has joined #crystal-lang
zamith has joined #crystal-lang
kulelu88 has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
zz_Cidan is now known as Cidan
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vs3OA
<crystal-gh> crystal/master 3e7670a Ary Borenszweig: Fixed #1121 and other similar issues with if conditions being always true/false
<crystal-gh> [crystal] krisleech opened pull request #1234: Fix class name generation for `crystal init` (master...improve-generators) http://git.io/vs3cy
Cidan is now known as zz_Cidan
<travis-ci> manastech/crystal#3e7670a (master - Fixed #1121 and other similar issues with if conditions being always true/false): The build passed. https://travis-ci.org/manastech/crystal/builds/76329797
NeverDie has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #1220: add tcp examples, fixed #1198 (master...tcp_examples) http://git.io/vsJgW
<crystal-gh> [crystal] asterite closed pull request #1234: Fix class name generation for `crystal init` (master...improve-generators) http://git.io/vs3cy
<travis-ci> manastech/crystal#627f849 (master - Merge pull request #1220 from kostya/tcp_examples): The build passed. https://travis-ci.org/manastech/crystal/builds/76337846
<travis-ci> manastech/crystal#112ce9f (master - Merge pull request #1234 from krisleech/improve-generators): The build passed. https://travis-ci.org/manastech/crystal/builds/76337909
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 246 seconds]
Dreamer3 has quit [Quit: Leaving...]
Dreamer3 has joined #crystal-lang
havenwood has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vs3xH
<crystal-gh> crystal/master 6b3ea5e Ary Borenszweig: Fixed #1226: can't use type variables in return types
leafybasil has joined #crystal-lang
<travis-ci> manastech/crystal#6b3ea5e (master - Fixed #1226: can't use type variables in return types): The build passed. https://travis-ci.org/manastech/crystal/builds/76344351
blue_deref has quit [Quit: bbn]
<crystal-gh> [crystal] kostya opened pull request #1236: add array#rotate (master...rotate) http://git.io/vssnj
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vssCu
<crystal-gh> crystal/master 3abb0c6 Ary Borenszweig: Fixed #1222: correct error message pointing where an instance variable was not initialized
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vss0Y
<crystal-gh> crystal/master 28bfaac Ary Borenszweig: Fixed #1223: Compiler crash when invoking previous_def with wrong number of arguments
<travis-ci> manastech/crystal#3abb0c6 (master - Fixed #1222: correct error message pointing where an instance variable was not initialized): The build passed. https://travis-ci.org/manastech/crystal/builds/76352388
n0xff has quit [Ping timeout: 255 seconds]
<crystal-gh> [crystal] PragTob opened pull request #1238: Spec/sort/doc remaining Enumerable methods (master...spec-more-enumerable) http://git.io/vssgr
<travis-ci> manastech/crystal#28bfaac (master - Fixed #1223: Compiler crash when invoking previous_def with wrong number of arguments): The build passed. https://travis-ci.org/manastech/crystal/builds/76354830
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vssww
<crystal-gh> crystal/master f818da2 Ary Borenszweig: Added `Array#flatten`. Fixes #1211. Related to #1084
kyrylo has quit [Quit: Konversation terminated!]
kyrylo has joined #crystal-lang
sleeper is now known as sleeper_
<travis-ci> manastech/crystal#f818da2 (master - Added `Array#flatten`. Fixes #1211. Related to #1084): The build passed. https://travis-ci.org/manastech/crystal/builds/76358068
crjoe has joined #crystal-lang
<crjoe> Is it possible to have a default value for a hash like rubys: h = Hash.new("") currently using: h = {} of String => String but want an empty string for default value
<jhass> >> h = Hash(String, String).new(""); h["foo"]
<DeBot> jhass: # => "" - http://carc.in/#/r/c0w
<crjoe> thanks jhass !
zamith has joined #crystal-lang
havenwood has joined #crystal-lang
waj has quit [Remote host closed the connection]
BlaXpirit has quit [Quit: Konversation]
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
<crjoe> is there a way to build a binary with crystal that includes glibc in it? when trying to run binary on another machine I get: /lib64/libc.so.6: version `GLIBC_2.14' not found
<crjoe> did it with: "--link-flags -static" got some warnings, but it works on both machines now
waj has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
leafybasil has quit [Ping timeout: 255 seconds]
trapped has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
waj has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/vsGgK
<crystal-gh> crystal/master 60e7974 Ary Borenszweig: Small change/fix in JSON pull parser