ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
ur5us has quit [Ping timeout: 240 seconds]
zorp has quit [Read error: Connection reset by peer]
ur5us has joined #crystal-lang
<repo> Depends on the country :)
<repo> if there’s anything like social structures in place you end up earning less. (Unlike in the US where each individual has to pay for everything)
<FromGitter> <3n-k1> does crystal have anything like C#'s `base()`? essentially, reusing an already existing constructor from a super class while still adding functionality to it?
<FromGitter> <stronny> `super` ?
<FromGitter> <3n-k1> i must've been using that wrong, i could never get that to work
<FromGitter> <stronny> show an example?
<FromGitter> <3n-k1> sure one sec
<FromGitter> <3n-k1> ahhhh i see what the issue was. the following errors unless you add `property name` to Foo ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e83eb6131afb17f989b4da4]
<FromGitter> <3n-k1> that makes sense now that i think about it
<FromGitter> <stronny> `super` without args calls parent's new with your args
<FromGitter> <stronny> `super` with args calls parent's new with what you've passed it
<FromGitter> <stronny> this problems seems to be related to instance vars, not really calling parent's contrunctor per se
<FromGitter> <3n-k1> is there anything similar to this that works for methods other than constructors? for instance, if i just want to slightly wrap a super classes method?
<FromGitter> <stronny> maybe I'm wrong about constructors now that I think about it
<FromGitter> <stronny> ```class Y < X; def x; super; puts :y end end ⏎ ⏎ Y.new.x`````` [https://gitter.im/crystal-lang/crystal?at=5e83ed2cb6d72077bcac007b]
<FromGitter> <stronny> ```$ ./test.cr ⏎ x ⏎ y``` [https://gitter.im/crystal-lang/crystal?at=5e83ed489a1e483f3d3624cf]
<FromGitter> <stronny> it's just that I usually do that with constructors and not much else
<FromGitter> <3n-k1> same, I was just wondering if it was possible. thanks for entertaining my newbie questions :P
postmodern has joined #crystal-lang
<FromGitter> <Blacksmoke16> `super` would call the parent's implementation
<FromGitter> <Blacksmoke16> there is also `previous_def`
<FromGitter> <stronny> it's for patching, not for inheritance
<FromGitter> <Blacksmoke16> previous_def?
<FromGitter> <stronny> yes
<FromGitter> <Blacksmoke16> similar concept, but yea not the same as super
<FromGitter> <stronny> previous_def doesn't accept args right?
<FromGitter> <Blacksmoke16> not that i know of no
<FromGitter> <Blacksmoke16> actual `Without arguments or parentheses, previous_def receives the same arguments as the method's arguments. Otherwise, it receives the arguments you pass to it.`
<FromGitter> <Blacksmoke16> i didnt test it but it seems it does
<FromGitter> <stronny> interesting
chachasmooth has quit [Ping timeout: 256 seconds]
chachasmooth has joined #crystal-lang
snosk8r has quit [Read error: Connection reset by peer]
<FromGitter> <paulcsmith> Hello! I’m planning to upgrade https://github.com/luckyframework/dexter to the new Log in 0.34. I’m having trouble finding the formatted option though? Does the new Log not allow setting for ⏎ matters? Or maybe it just isn’t documented?
<FromGitter> <paulcsmith> Of course right after I post I find it ;)
<FromGitter> <paulcsmith> Correction: Log::IOBackend
snosk8r has joined #crystal-lang
ur5us has quit [Ping timeout: 252 seconds]
_ht has joined #crystal-lang
postmodern has quit [Read error: Connection reset by peer]
postmodern has joined #crystal-lang
postmodern has quit [Remote host closed the connection]
postmodern has joined #crystal-lang
ur5us has joined #crystal-lang
sagax has quit [Remote host closed the connection]
sagax has joined #crystal-lang
snosk8r has quit [Remote host closed the connection]
snosk8r has joined #crystal-lang
ur5us has quit [Ping timeout: 252 seconds]
snosk8r has quit [Quit: Leaving]
snosk8r has joined #crystal-lang
lvmbdv8 has joined #crystal-lang
lvmbdv has quit [Read error: Connection reset by peer]
lvmbdv8 is now known as lvmbdv
masterdonx2 has joined #crystal-lang
MasterdonX has quit [Ping timeout: 256 seconds]
postmodern has quit [Quit: Leaving]
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
deavmi has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
deavmi has joined #crystal-lang
zorp has joined #crystal-lang
<FromGitter> <stronny> so I have a question about GC. When I do `a = slice.new(10)` the allocated buffer lives in `a` and a has a pointer to its first byte and its size, no problem. If later I do `b = a + 5`, now `b` has a pointer to some random byte, so how does GC manage these cases?
<FromGitter> <stronny> I mean when does it free `a` and/or `b`?
yxhuvud has quit [Remote host closed the connection]
<FromGitter> <ImAHopelessDev_gitlab> hi
<jhass> > Pointers from the stack or registers may point to anywhere inside an object.
<FromGitter> <stronny> so the buffer won't go away as long as somewhere there's at least one pointer to any byte in the buffer?
<FromGitter> <mamantoha> @Blacksmoke16 got it. Thanks
yxhuvud has joined #crystal-lang
<Stephie> something broke macos ci :(
<yxhuvud> RIP
<raz> F
_ht has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#90b5997 (master - Merge pull request #8975 from RX14/feature/websocket-close-codes): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669658244
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
<DeBot> https://github.com/crystal-lang/crystal/pull/8975 (Correctly support websocket close codes)
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<raz> hrmpf. these golang PR-reviews are getting on my nerves. 300 lines of boilerplate for what would amount to 10 lines in a proper language. and then another 50 of tests.
<raz> github really needs a 'convert to crystal' button
<FromGitter> <tenebrousedge> :P
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
rohitpaulk has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Ping timeout: 256 seconds]
_ht has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#e7e7786 (master - Install LLVM 10 for OSX CI (#8982)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669738707
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8982 (Install LLVM 10 for OSX CI)
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#ea84350 (master - Fix Windows codegen (LLVM globals) in non-singlemodule mode (#8978)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669743563
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8978 (Fix Windows codegen (LLVM globals) in non-singlemodule mode)
<FromGitter> <asterite> raz what's an example golang PR you were looking at? (just out of curiosity)
<raz> asterite: company code so can't share. but am tempted to say... pick any golang PR ever ;)
<raz> the verbosity is just absurd. and the awful syntactic mix between JavaStyleVeryLongIdentifiers and perl'esque line noise *->:= doesn't help my migraine either.
<FromGitter> <stronny> `value, err = any_func_call`
<raz> if err != nil { fmt.Println("exceptions are too complicated for you. let's code like in the 1960s, much safer!") }
DTZUZU2 has joined #crystal-lang
DTZUZU has quit [Ping timeout: 256 seconds]
sorcus has quit [Ping timeout: 252 seconds]
sorcus has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
DTZUZU2 has quit [Ping timeout: 258 seconds]
DTZUZU2 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter> <alehander92> i still think errors maybe ok
<FromGitter> <alehander92> you can see that many languages like rust, haskell and much more
<FromGitter> <alehander92> dont really use a lot of exceptions, but they offer nice abstractions/syntax sugar for their results
<FromGitter> <alehander92> exceptions are not really complicated, but type safety with them is
postmodern has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> golang helped me tremendously to want to use crystal
<FromGitter> <ImAHopelessDev_gitlab> same for rust's syntax
lvmbdv has quit [Quit: bye]
lvmbdv has joined #crystal-lang
early` has quit [Quit: Leaving]
rohitpaulk has joined #crystal-lang
early has joined #crystal-lang
<FromGitter> <kinxer> I haven't used Go, but Rust does have some cool features that would be nice in Crystal, like defining methods on a generic type only when it has a particular type variable and, of course, exhaustive case statements (which it seems like Crystal will get!).
<FromGitter> <tenebrousedge> yes, exhaustive case has been merged
<FromGitter> <kinxer> Excellent. Is it likely to make it into the next release, then?
<FromGitter> <tenebrousedge> I didn't look but I would assume so
rohitpaulk has quit [Ping timeout: 256 seconds]
<travis-ci> crystal-lang/crystal#7179a27 (ci/update - Temp: Update distribution-scripts): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669847255
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
<FromGitter> <tenebrousedge> conditional method definition like that doesn't seem like it would be possible
<FromGitter> <tenebrousedge> although I'm not quite sure what you're talking about
<FromGitter> <asterite> yes, exhaustive case will be in the next release as a warning. Later on it will be an error
<FromGitter> <asterite> @kinxer "like defining methods on a generic type only when it has a particular type variable" -> can you show an example of that? (a link)
<FromGitter> <kinxer> I'm a novice at Rust (not a lot of opportunity to use it so far...), but I understood trait implementations like in that link as filling a similar role to generic types.
<FromGitter> <kinxer> Though I guess Traits are more like generic *modules*.
<FromGitter> <kinxer> I know in Crystal you can do something like ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5e84f1aeb5496402d8ae603a]
<FromGitter> <stronny> so what is it that can you do in rust with traits that you can't do in Crystal?
<FromGitter> <asterite> I guess in Rust you can define methods only on Array(Int64) but not on other types
<FromGitter> <asterite> How does that show up in docs?
<FromGitter> <kinxer> It does make the docs somewhat messy (to a newcomer, at least).
<FromGitter> <asterite> Also, in Crystal we might not need that. `Enumerable` defines `sum` and that only works if methods have a `+` method, but that is implicit... the method "exists" for all types but only compiles for certain types
<FromGitter> <asterite> Also, you can always do `{% if T ... %}` inside the method and raise at compile time if T isn't what you expected. Then the method will appear in docs but you can say "But this only works if..."
<FromGitter> <kinxer> Yeah, the implicit requirements like that do exist, and they make the language more flexible, but they aren't particularly self-documenting.
<FromGitter> <asterite> It's true
<FromGitter> <kinxer> Yeah. I think I've done that at some point with something...
<FromGitter> <kinxer> Anyway, this isn't really an actual feature request. I don't feel strongly that the Rust-like generic-implementation stuff actually belongs in Crystal.
<FromGitter> <stronny> I guess sometimes I wish I could say `class Tree(T : Int)`
<FromGitter> <stronny> but that's not a huge deal breaker for me
<FromGitter> <kinxer> I just know that I've run into cases in the past in which I thought that it would be nice to have (though I can't remember off-handedly what I was trying to do when I thought that).
<FromGitter> <asterite> I think adding methods to specific generic instances is possible (from the perspective of how the compiler is implemented), but we'll need to see how to document those. Also it comes together with how to constraint types. Maybe you want to apply a method to `Array(Int)` where `Int` can be `Int32`, `Int64`, etc., so that's like `Array(T) where T < Int` but there's no such thing in the language... so it's a huge
<FromGitter> ... change... for maybe not a common use case
<FromGitter> <stronny> `Array(T : Int)`
<FromGitter> <stronny> even backwards compatible
<FromGitter> <stronny> or Int.class if you insist
<FromGitter> <kinxer> Yeah... I do think the generic type constraints would be useful, though, from the point of view of easily giving more useful compile-time errors (e.g. `generic type of X must be a Y` instead of a message about missing some method).
<FromGitter> <kinxer> That syntax is also semantically consistent with the rest of the language.
<FromGitter> <stronny> that should support modules too
<FromGitter> <stronny> T : Enumerable
ur5us has joined #crystal-lang
<FromGitter> <stronny> and then we'll get the generics overloads like `Array(T : Enumerable), Array(T : Bool?), Array(T, N)` lol
<FromGitter> <stronny> Crystal++
<FromGitter> <kinxer> What's that last one you have? `Array(T, N)`?
<FromGitter> <stronny> I guess in ++ you could also overload on the value of N even
<FromGitter> <stronny> `Array(Int, 3) or whatever`
<FromGitter> <stronny> I didn't think that one through, but I could imagine something
<FromGitter> <kinxer> Isn't that how `StaticArray` already works?
<FromGitter> <stronny> yeah
<FromGitter> <stronny> so you could drop it in favour of a single template!
<FromGitter> <stronny> (I'm mostly joking here)
<FromGitter> <kinxer> Yeah, I was slow on the uptake but realized that.
<FromGitter> <asterite> The problem is, what happens if you add a method to `Array(T : Foo)` and then to `Array(T : Bar)`, both modules, and a type includes both? It becomes a bit confusing. The current way is simple: there's only one definition for all types
<FromGitter> <kinxer> I use C++ a lot for my job, but we don't really use any templating (or really any new language features from the last two decades except STL containers and looping over them), so some of my coworkers joke that we just use C+.
<FromGitter> <asterite> :-D
<FromGitter> <kinxer> Yeah, in that example with two modules, I guess it would either depend on ordering of something somewhere (my vote would be the order of the `include`s) or give an error about conflicting definitions.
<FromGitter> <stronny> what's the rule with overloading now?
<FromGitter> <stronny> what if I have `method(x : Enumberable)` and `method(x : Indexable)` and call `method([1,2,3])`?
<FromGitter> <kinxer> Also, what happens right now when you include two modules with the same method in a single class?
<FromGitter> <stronny> the second one will shadow the first one I imagine
<FromGitter> <kinxer> Yeah, that looks to be the case: https://carc.in/#/r/8teh
<FromGitter> <asterite> @stronny when there's no clear answer, the compiler tries one by one per definition ordr
<FromGitter> <stronny> so it could do the same with generics
<FromGitter> <stronny> c o n s i s t e n c y
<FromGitter> <kinxer> Surely there's already been discussion of type constraints on generics, right?
<FromGitter> <kinxer> Yeah, I was about to mention that one, too. :P
<FromGitter> <kinxer> It appears to be basically what I was talking about earlier.
<FromGitter> <stronny> that's a pretty basic idea really
<FromGitter> <kinxer> I personally don't like the `class A(T = B)` syntax, though.
<FromGitter> <stronny> `virtual void method() = 0;`
<FromGitter> <stronny> what about macro specializations?
<FromGitter> <kinxer> Macro specializations?
<FromGitter> <stronny> two macros with the same name doing different things
<FromGitter> <stronny> based on arguments somehow
<FromGitter> <kinxer> Do macros have type constraints?
<FromGitter> <stronny> not currently no
<FromGitter> <stronny> they don't have anything like a shell function
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
zorp has quit [Read error: Connection reset by peer]
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#262de8a (ci/update - Temp: Update distribution-scripts): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669881968
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#c4160c0 (ci/update - Temp: Update distribution-scripts): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669888397
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
coderobe5 has joined #crystal-lang
melthelesbian_ has joined #crystal-lang
melthelesbian has quit [*.net *.split]
coderobe has quit [*.net *.split]
coderobe5 is now known as coderobe
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
return0e_ has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#075c361 (ci/update - Update distribution-scripts (shards 0.10.0)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669904935
travis-ci has left #crystal-lang [#crystal-lang]
melthelesbian_ is now known as melthelesbian
<FromGitter> <Blacksmoke16> @kinxer figured out why the validator is not compile time safe
<FromGitter> <Blacksmoke16> i have a type that returns the validator to use given a context, `@constraint_validator_factory.validator constraint`. however since the return type is the interface, which would essentially be a union of all validators, it doesnt know which specific validator it will be
ur5us has quit [Ping timeout: 252 seconds]
ur5us has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <bcardiff> In a couple of hours nightlies should be published again 🎉
<FromGitter> <Blacksmoke16> \o/
<FromGitter> <bcardiff> This is not an april fools update
<FromGitter> <bcardiff> just in case
rohitpaulk has quit [Ping timeout: 250 seconds]