<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
<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 :(
<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.
<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
<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.
<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
<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
<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
<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"]
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