jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
teardown has quit [Ping timeout: 240 seconds]
teardown has joined #crystal-lang
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
teardown has quit [Ping timeout: 240 seconds]
teardown_ has joined #crystal-lang
sorcus has quit [Ping timeout: 260 seconds]
sorcus has joined #crystal-lang
sagax has quit [Ping timeout: 260 seconds]
postmodern has joined #crystal-lang
<FromGitter> <bew> @hightower4 hey! It was mainly to understand better how terminfo worked, and to write a pure crystal version of unibilium for an hypothetic upcoming pure crystal terminal lib. FYI I don't do much crystal nowadays (went for rust, learning with AoC right now)
<FromGitter> <Blacksmoke16> boo
<FromGitter> <Daniel-Worrall> Did anyone figure out the equation for AoC day 10 part 2? Without going through `each_combination`?
<FromGitter> <Daniel-Worrall> I spent forever trying to figure it out. Came up with half of it, gave up, found out the largest group of 1 differences was 5 which I had already calculated by hand :|
<FromGitter> <tenebrousedge> I'm still on 9.2
hightower4 has quit [Ping timeout: 240 seconds]
chachasmooth has quit [Ping timeout: 272 seconds]
chachasmooth has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 272 seconds]
chachasmooth has quit [Ping timeout: 260 seconds]
chachasmooth has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
teardown has joined #crystal-lang
teardown_ has quit [Ping timeout: 240 seconds]
sagax has joined #crystal-lang
z64 has quit [Ping timeout: 246 seconds]
_whitelogger has joined #crystal-lang
hightower3 has joined #crystal-lang
<FromGitter> <mwlang> Thanks for the tip. Will check that out. Extending specs myself is more appealing than adopting a new shard as I've been burned a couple times with shards for test frameworks.
<FromGitter> <mwlang> Hmmm...Could you elaborate on that? I didn't see Webmock documented here: https://crystal-lang.org/api/0.34.0/
<FromGitter> <mwlang> and the manatech/webmock repo doesn't seem to indicate it's a std library.
<FromGitter> <watzon> It's not, but I think Ary is saying that it should be because it is kind of essential for testing API driven code
_whitelogger has joined #crystal-lang
<kevinsjoberg> Is https://play.crystal-lang.org broken?
<kevinsjoberg> Why does this not yield any output?
<FromGitter> <naqvis> yeah seems both play and carc are having problems ⏎ https://carc.in/#/r/a3hw
bazaar has quit [Ping timeout: 264 seconds]
bazaar has joined #crystal-lang
<kevinsjoberg> What's the difference between play and carc?
<FromGitter> <naqvis> no difference, just two different playground
<FromGitter> <naqvis> iirc carc is hosted by jhass
<kevinsjoberg> I see.
<FromGitter> <erdnaxeli:cervoi.se> @Daniel-Worrall: I did, without each_combination. There is actually a O(n) algorithm to do it.
ua has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
postmodern has quit [Quit: Leaving]
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
<yxhuvud> There are multiple, very different O(n) solutions for it. One which abuses the fact that there are no 2-steps and one that just don't care.
<FromGitter> <erdnaxeli:cervoi.se> oh, I was wondering if you could abuse that, I didn't find how to do it
<FromGitter> <KevinSjoberg> Finally solved day 10 part 2 by counting paths to n... Not sure why I didn't see that solution yesterday.
<FromGitter> <Daniel-Worrall> Do you guys have repos for aoc2020 to look through?
<FromGitter> <Daniel-Worrall> Yeah, I went with the no-2-step solution
<FromGitter> <erdnaxeli:cervoi.se> you can find repo here: https://github.com/search?p=2&q=crystal+adventofcode&type=Repositories
liteyear has joined #crystal-lang
<FromGitter> <anapsix> > any reason for all the complexity? versus just like having the interval be a static value like unix time? ⏎ ⏎ do you mean using second precision for the interval, and always using seconds? ⏎ I was hoping to have it resemble the syntax of creating `Time::Span` from numbers [https://gitter.im/crystal-lang/crystal?at=5fd3604f3dd3b251a4fcdc1a]
<FromGitter> <anapsix> I suppose, another way about it making `Time::Span::Format`, and making `Time::Span.parse`
<FromGitter> <anapsix> 🐒
<Andriamanitra> what am i doing wrong? (repl.it because carc.in seems to be down) https://repl.it/@Andriamanitra/NaiveNeighboringAutomaticvectorization#main.cr
<kevinsjoberg> Andriamanitra: Looks right to me.
<kevinsjoberg> real.it probably broken if you ask me
<kevinsjoberg> repl.it*
<Andriamanitra> no, it doesn't work on my machine either
<kevinsjoberg> Works perfectly on my machine.
<kevinsjoberg> nvm, it does not. sorry about that.
<FromGitter> <HertzDevil> is there a reason you have to use inheritance instead of composition
<Andriamanitra> hmm, probably not
<Andriamanitra> but i'd still like to understand :D
<FromGitter> <HertzDevil> it fails because that constructor always forwards to `Array(T).build`
<FromGitter> <HertzDevil> i.e. is invariant
<kevinsjoberg> I guess it's not working since you're not specifying the types.
<FromGitter> <HertzDevil> when you inherit a type only the `#initialize` constructors are inherited
<FromGitter> <HertzDevil> not the `self.new` ones
<Andriamanitra> ah i see, so i would just need to define my own self.new that uses the #initialize constructor instead?
<FromGitter> <HertzDevil> if you really must, yes
<FromGitter> <HertzDevil> even if the exact same constructor is in `Array`
<FromGitter> <HertzDevil> you could always do the "dumb" thing of building the grid yourself
<FromGitter> <HertzDevil> ```grid = MyGrid.new(h) ⏎ h.times { grid << Array.new(w, 0) } ⏎ grid``` [https://gitter.im/crystal-lang/crystal?at=5fd373c603da931ac246adc9]
<FromGitter> <anapsix> would creating a self methods via inherited macro help in this case?
<FromGitter> <HertzDevil> why would you reopen `Array` to do this
<FromGitter> <naqvis> Andriamanitra instead of inheritance, i would recommend to go with composition
<jhass> >> "I'm back now, upgrade went wrong :)"
<DeBot> jhass: # => "I'm back now, upgrade went wrong :)" - https://carc.in/#/r/a3iv
<FromGitter> <naqvis> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd3743a3dd3b251a4fd0f39]
<FromGitter> <HertzDevil> and no, `macro inherited` wouldn't help
<Andriamanitra> naqvis: ooh, i did not know about forward_missing_to, that's nice!
<FromGitter> <HertzDevil> the bodies of those `self.new` constructors are still referring to the other constructors of `Array`
<FromGitter> <HertzDevil> and you cannot change the bodies from macros
<Andriamanitra> is there any legitimate reason to ever use inheritance then? or should i just stick to composition
<FromGitter> <naqvis> I prefer composition over inheritance aka compose reuse principle ⏎ https://en.wikipedia.org/wiki/Composition_over_inheritance
<FromGitter> <tenebrousedge> I feel like inheritance is fine if you're doing like a Rails model or controller
<FromGitter> <tenebrousedge> I'm not sure what distinguishes that from the norm
<FromGitter> <tenebrousedge> because this is the before-coffee hour
<FromGitter> <naqvis> :P
<FromGitter> <naqvis> copied directly from Wikipedia ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd3764155c9c37b305c56f2]
<FromGitter> <ImAHopelessDev_gitlab> hi
<FromGitter> <ImAHopelessDev_gitlab> hmm composition and inheritance, perfect topic for me to join in on!
<FromGitter> <ImAHopelessDev_gitlab> wait a minute, i'm a procedural kinda guy, is this still relevant to me ?
<FromGitter> <naqvis> Hi Girng
<FromGitter> <naqvis> nope
<FromGitter> <ImAHopelessDev_gitlab> good that wikipedia article got too confusing lmao
<FromGitter> <naqvis> but if someday you change your mind to OOP, then you might need to think about it :P
<FromGitter> <tenebrousedge> but you may be less procedural than you want
<FromGitter> <tenebrousedge> procedural code is sort of inherently longer and more duplicative
<Andriamanitra> it's good to be familiar with multiple paradigms, that way you can combine them and use each to their strengths
_ht has joined #crystal-lang
<FromGitter> <naqvis> Andriamanitra its nice to override `[]` operator, so you get a more natural look for `MyGrid` usage like `MyGrid[10,10]` instead of `MyGrid.new(10, 10)`
_ht has quit [Client Quit]
<FromGitter> <ImAHopelessDev_gitlab> i use oop, but only the basics, like dot notation and objects? inheritance and composition seem too complex for no reason
<FromGitter> <naqvis> https://carc.in/#/r/a3iy
<FromGitter> <naqvis> not a big deal, but might be good to eyes :P
_ht has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> MyGrid.new(10, 10) ⏎ ⏎ jeez @naqvis !!!
<FromGitter> <ImAHopelessDev_gitlab> ClassName[BRACKET_NOTATION] looks funky
<FromGitter> <naqvis> that's not my grid, its Andriamanitra :P
<FromGitter> <naqvis> true, but give kind of matrix look
<FromGitter> <ImAHopelessDev_gitlab> but i mean, who am i to say what looks good. igot spaghetti code ;D
<FromGitter> <naqvis> refactoring is a thing :D
<FromGitter> <ImAHopelessDev_gitlab> i interoperate that sentence as my code is a carving on a rock...
<FromGitter> <ImAHopelessDev_gitlab> rofl
<hightower3> jhass, I'd like to add a test for https://github.com/crystal-lang/crystal/issues/8428 so that we can close that ticket. Any advice which test file I would add this into?
<FromGitter> <naqvis> 😆
<FromGitter> <ImAHopelessDev_gitlab> @naqvis i hjave so much code i forgot what most of it does
<FromGitter> <Blacksmoke16> coughshouldhavewrotetestscough
<FromGitter> <ImAHopelessDev_gitlab> luckily i got some comments every now and then, that helps though
<Andriamanitra> i'm not sure about using [] to initialize things, might get confusing as i'll also need to index into the grid
<FromGitter> <naqvis> unfortunately that's the dilemma every Perl programmer face :P
<hightower3> naqvis :)
<FromGitter> <tenebrousedge> there's way too much Perl in Ruby for me to throw stones
<FromGitter> <ImAHopelessDev_gitlab> i mean, i view everything in life as an object that has a tree attached to it
<FromGitter> <ImAHopelessDev_gitlab> like a class/struc twith `property` macros
<FromGitter> <ImAHopelessDev_gitlab> and if i were coding in js, it would be a js object
<FromGitter> <naqvis> Girng, i'm sure you have defined classes/structs and those contains other objects. So you have been using composition without even knowing its happening :D
<FromGitter> <tenebrousedge> that's not very procedural in thinking
<FromGitter> <ImAHopelessDev_gitlab> for example, a keyboard is a keyboard class/struct. then the properties are the letters
<FromGitter> <ImAHopelessDev_gitlab> if i want to sell that keyboard to a friend, i create a method, handle_keyboard_trade()
<FromGitter> <ImAHopelessDev_gitlab> keyboard1, keyboard2 are parameters, each one is a keyboard object
<FromGitter> <tenebrousedge> that part is procedural
<FromGitter> <ImAHopelessDev_gitlab> yes, so maybe i have a mix of both
<FromGitter> <ImAHopelessDev_gitlab> but not a lot of oop just ahint of it
<FromGitter> <naqvis> how do you call that method? `keyboard1.handle_keyboard_trade()` or `handle_keyboard_trade(keyboard)` ?
<FromGitter> <tenebrousedge> OO would be defining Keyboard#trade, or more likely User#trade and pass keyboard
<FromGitter> <ImAHopelessDev_gitlab> EWWWW
<FromGitter> <ImAHopelessDev_gitlab> how can a keyboard have a trade method
<FromGitter> <ImAHopelessDev_gitlab> that's where i leave OO alone, I guess. everyone is different
<FromGitter> <tenebrousedge> deciding where methods live can be situational, but like, there was a reason for the second part of that sentence
<FromGitter> <tenebrousedge> but either way
<FromGitter> <tenebrousedge> `keyboard#trade` or `user#trade` would be OO, and `handle_keyboard_trade(k1, k2)` would be procedural
<FromGitter> <ImAHopelessDev_gitlab> look at the human anatomy. Human is a class, property macro for brain, arm, all other parts. Now `trade` makes sense as a method
<FromGitter> <tenebrousedge> having a lot of globally scoped methods like `handle_keyboard_trade(k1, k2)` would probably not result in good code
<Andriamanitra> ok so now that i'm using this fancy Object#forward_missing_to how do i specifically exclude some methods? just override them with an empty method or is there a better way?
<FromGitter> <ImAHopelessDev_gitlab> Because a human has the ability to TRADE something with another human
<FromGitter> <tenebrousedge> yes hon
<FromGitter> <Blacksmoke16> Andriamanitra prob not use that method and look into `delegate`
<FromGitter> <tenebrousedge> ^
<FromGitter> <ImAHopelessDev_gitlab> @tenebrousedge I think OOP makes more sense with living things and their inherent/intrinsic values
<FromGitter> <Blacksmoke16> what and your code isnt a living thing
<Andriamanitra> i can't trust myself not to use things! :p i think i'll override with a method that raises exception
<FromGitter> <ImAHopelessDev_gitlab> i mean whatever object it is. for example a keyboard class for a Human class and a `trade` method
<FromGitter> <Blacksmoke16> Andriamanitra thats prob not ideal but ok
<Andriamanitra> what would be ideal then? []= specifically has potential to break all kinds of things with my grid
<FromGitter> <Blacksmoke16> @ImAHopelessDev_gitlab thats where inheritance/composition comes in `#trade(item : Item)`
<FromGitter> <ImAHopelessDev_gitlab> a keyboard doesn't have the ability to trade itself, so it needs a method/function to handle it. a human has the ability to trade, so a `trade` method given to the human class makes sense.
<FromGitter> <Blacksmoke16> where `Keyboard < Item`
<FromGitter> <naqvis> Andriamanitra if you want to proxy few methods of Array then use `delegate`, but if you want to hide very few methods then better define them in your class
<FromGitter> <HertzDevil> the more code you write the more you realize it's less about whether oop is better than other paradigms and more about how polymorphism is implemented
<FromGitter> <ImAHopelessDev_gitlab> is that like method overloading?
<FromGitter> <ImAHopelessDev_gitlab> i'm against method overloading, vehemently
<FromGitter> <Blacksmoke16> boo
<FromGitter> <Blacksmoke16> its super helpful
<FromGitter> <ImAHopelessDev_gitlab> more like, super confusing
<FromGitter> <Blacksmoke16> not really, whats more confusing is 1 large method that does a bunch that could have been a few overloads
<FromGitter> <ImAHopelessDev_gitlab> methods littered all over, that take in different parameters. make another method
<FromGitter> <Blacksmoke16> normally overloads are part of a type, i.e. methods not functions
<FromGitter> <ImAHopelessDev_gitlab> https://www.geeksforgeeks.org/overloading-in-java/
<FromGitter> <ImAHopelessDev_gitlab> hf with arithmetic overflow errors
<FromGitter> <Blacksmoke16> i mean thats no different than crystal?
<FromGitter> <ImAHopelessDev_gitlab> no
<FromGitter> <Blacksmoke16> not sure what your point is
<FromGitter> <ImAHopelessDev_gitlab> same concept
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/a3j5
<FromGitter> <tenebrousedge> not having overloading would probably make `+` kinda lame
<FromGitter> <ImAHopelessDev_gitlab> https://play.crystal-lang.org/#/r/a3jb
<FromGitter> <ImAHopelessDev_gitlab> pretend the i8 is from db
<FromGitter> <HertzDevil> that has nothing to do with overloading though?
<FromGitter> <HertzDevil> just use `&+`
<FromGitter> <Blacksmoke16> ^ not sure what your point is
<FromGitter> <HertzDevil> or convert the `Int8`s at the call site
<FromGitter> <ImAHopelessDev_gitlab> https://crystal-lang.org/api/0.35.1/Enumerable.html look at .join
<FromGitter> <Blacksmoke16> what about it?
<FromGitter> <ImAHopelessDev_gitlab> you got `join(separator = "", & : T -> )` `join(separator, io : IO, &)` `join(io : IO, separator = "", & : T, IO -> )` `join(separator = "")` `join(separator, io : IO)` `join(io : IO, separator = "")`
<FromGitter> <ImAHopelessDev_gitlab> like WTF. it's just a join
<FromGitter> <Blacksmoke16> two of those are deprecated, but i dont see your point
<FromGitter> <HertzDevil> what about it?
<FromGitter> <Blacksmoke16> one accepts an io, one just creates a string as is, one yields each item
<Andriamanitra> overloading is awesome, why would you want to type str.split_by_regex(rgx) when you could just overload the short method name?
<FromGitter> <ImAHopelessDev_gitlab> `Returns a String created by concatenating the results of passing the elements in the collection to the passed block, separated by separator (defaults to none).`
<FromGitter> <ImAHopelessDev_gitlab> `Prints to io the concatenation of the elements, with the possibility of controlling how the printing is done via a block.`
<FromGitter> <Blacksmoke16> right
<FromGitter> <Blacksmoke16> two diff ways of doing the same thing, hence overloads versus `join_io` and `join` methods
<FromGitter> <ImAHopelessDev_gitlab> so now, .join returns diff results. more confusion to the developer. 1 action, 1 method
<FromGitter> <ImAHopelessDev_gitlab> it's that simple
<FromGitter> <ImAHopelessDev_gitlab> simplicity is key
<FromGitter> <Blacksmoke16> :rolls_eyes:
<Andriamanitra> you just need to think of the type signature as part of the method name
<Andriamanitra> there shouldn't be any confusion as long as you know what the types of your variables are, and if you don't i think you have bigger problems
<FromGitter> <HertzDevil> that looks simple to me
<FromGitter> <ImAHopelessDev_gitlab> now just .join, it's everywhere outside of crystal too!
<FromGitter> <HertzDevil> an example of overloading that isn't simple is `Array#product`
<FromGitter> <Blacksmoke16> i think he has a tendency to dislike anything and everything he doesn't understand
<FromGitter> <ImAHopelessDev_gitlab> nope i use .join and method overloading i think
<FromGitter> <Blacksmoke16> if it was confusing people wouldnt use/define overloads
<FromGitter> <ImAHopelessDev_gitlab> i just think, 1 method per result is ideal
<FromGitter> <ImAHopelessDev_gitlab> 1 method NAME
<FromGitter> <ImAHopelessDev_gitlab> unique
<FromGitter> <Blacksmoke16> that just sounds annoying
<FromGitter> <HertzDevil> `1.0.float64_add_int32(5)` is ideal
<FromGitter> <Blacksmoke16> `add_in32`, `add_int64`, ...
<FromGitter> <ImAHopelessDev_gitlab> sounds.. easy and less complex and figuring out what parameters to pass in
<FromGitter> <Blacksmoke16> i dont really care about what method it is, i just want to add two numbers
<FromGitter> <Blacksmoke16> that would get quickly verbose
<FromGitter> <ImAHopelessDev_gitlab> what u mean verbose
<FromGitter> <ImAHopelessDev_gitlab> about adding two numbers
<FromGitter> <Blacksmoke16> `1.0 + 10_i64` versus `1.0.add_int64_to_float64 10_i64`
<FromGitter> <erdnaxeli:cervoi.se> is there libraries to plot graph in crystal? I just saw this https://imgur.com/a/BnptlYq (aoc 11 spoiler) and I want to do the same :p
<FromGitter> <ImAHopelessDev_gitlab> for numerals, i think it's fine because numerical system is complex
<FromGitter> <ImAHopelessDev_gitlab> but for method names, nope
<FromGitter> <Blacksmoke16> okey dokey
<FromGitter> <ImAHopelessDev_gitlab> if you want to have the same method name, performing different things based on it's paramaeters.. fine by me. but it adds a layer of complexity and harder readability. both are detrimental
<FromGitter> <HertzDevil> you say as though `+` isn't a method name
<FromGitter> <Blacksmoke16> ^
<FromGitter> <ImAHopelessDev_gitlab> for math, or operators it's fine
<FromGitter> <HertzDevil> it indeed isn't in a language like java
<FromGitter> <HertzDevil> and tbf that's somehow worse than languages where `+` is redefinable
<FromGitter> <ImAHopelessDev_gitlab> @Blacksmoke16 not everything in programming is good, u know
<FromGitter> <Blacksmoke16> no, but overloads arent one of them
<FromGitter> <ImAHopelessDev_gitlab> u seem to vehemently defend all the conventional use cases in programming
<FromGitter> <Blacksmoke16> i didnt invent them, i just embrace the tools that are available
<FromGitter> <ImAHopelessDev_gitlab> u don't need to embrace, though
<FromGitter> <Blacksmoke16> that allows me to write more readable code to others who also know about those concepts
<FromGitter> <ImAHopelessDev_gitlab> be free
<FromGitter> <Blacksmoke16> then id end up with code that looks like yours :shrug:
<FromGitter> <tenebrousedge> well we have learned the hard way the value of these things
<FromGitter> <Blacksmoke16> i like 🍝 but not with my code :P
<FromGitter> <tenebrousedge> no one starts out being a vehement defender of OO
<FromGitter> <ImAHopelessDev_gitlab> it's like art
<FromGitter> <tenebrousedge> and we're probably not super sold on, say, OO vs FP
<FromGitter> <Blacksmoke16> sure, your approach is abstract and mine is realism xD
<FromGitter> <tenebrousedge> but OO vs procedural is a lot easier to find strong arguments for one side
<FromGitter> <ImAHopelessDev_gitlab> bad example on art, i take that back
<FromGitter> <ImAHopelessDev_gitlab> let me get a better analogy
<FromGitter> <Blacksmoke16> im also not bashing functional programming as i dont really know anything about it
<FromGitter> <Blacksmoke16> at least never used it
<FromGitter> <ImAHopelessDev_gitlab> i tried so many times i gave up. i even posted on elixir forum for months
<FromGitter> <tenebrousedge> imagine no instance methods
<FromGitter> <ImAHopelessDev_gitlab> my brain can't comprehend the functional paradigm
<Andriamanitra> my philosophy is paradigms should serve you, you shouldn't serve paradigms :p
<FromGitter> <ImAHopelessDev_gitlab> @tenebrousedge mind just blew up. what's encapsulating methods then???
<FromGitter> <erdnaxeli:cervoi.se> > <@erdnaxeli:cervoi.se> is there libraries to plot graph in crystal? I just saw this https://imgur.com/a/BnptlYq (aoc 11 spoiler) and I want to do the same :p ⏎ ⏎ I found this https://github.com/stumpycr/stumpy_png
<FromGitter> <Blacksmoke16> to be clear, there is a difference between a method and a function
<FromGitter> <HertzDevil> even if you need different "method names" you can still have the same method name but different required named arguments, and to this end crystal already does it better than many other languages supporting oop
<FromGitter> <ImAHopelessDev_gitlab> i view methods in crystal as carving on a rock
<FromGitter> <ImAHopelessDev_gitlab> that's with the parameters set in stone
<FromGitter> <ImAHopelessDev_gitlab> if u want a method to do something different, carve a new fcking rock ffs
<FromGitter> <HertzDevil> like `[0, 1, 4, 9, 16].each(within: 1..3)`
<FromGitter> <ImAHopelessDev_gitlab> and go find one down at the beach
<FromGitter> <Blacksmoke16> @ImAHopelessDev_gitlab also to be clear overloads are meant to do the *same* thing, just with diff args
<FromGitter> <HertzDevil> the `within:` is mandatory
<FromGitter> <HertzDevil> iirc it's popular with objective-c too
<FromGitter> <Blacksmoke16> like with your join example, the one joins with the separator and returns a string, the other joins with the separator but writes it to the io
<FromGitter> <HertzDevil> we should normalize that
<FromGitter> <Blacksmoke16> they are both joining, its not like they're doing totally different things but have the same name
<FromGitter> <HertzDevil> you could then have "overloads" that are guaranteed not to overlap because the mandatory parameter names are different
<FromGitter> <ImAHopelessDev_gitlab> .join(seperator) that's that
<FromGitter> <Blacksmoke16> that uses the io overload
<FromGitter> <ImAHopelessDev_gitlab> anything else, new method
<FromGitter> <Blacksmoke16> which uses the block version :p
<FromGitter> <ImAHopelessDev_gitlab> rofl look at all the `joins`
<FromGitter> <HertzDevil> that's an (unsound) argument against making these particular methods overloads of each other, not an argument against all overloaded methods
<FromGitter> <ImAHopelessDev_gitlab> `each_with_object`, `each_with_index` is a good example
<FromGitter> <ImAHopelessDev_gitlab> that's some good method naming
<FromGitter> <Blacksmoke16> because they do separate things
<FromGitter> <ImAHopelessDev_gitlab> exactly
<FromGitter> <Blacksmoke16> i.e. they're not overloadable really
<FromGitter> <ImAHopelessDev_gitlab> good lol
<FromGitter> <Blacksmoke16> so whats your point?
<FromGitter> <HertzDevil> that's not true they both have block and non-block overloads
<FromGitter> <Blacksmoke16> fair point, forgot about that
<FromGitter> <ImAHopelessDev_gitlab> they are uniquely named methods, that do different things
gangstacat has quit [Quit: Ĝis!]
<FromGitter> <Blacksmoke16> but `join` does the same thing and is named the same
<Andriamanitra> i think we all agree that methods that do different things should be named different so i don't really see your point
<FromGitter> <ImAHopelessDev_gitlab> join does different things
<FromGitter> <Blacksmoke16> how you figure?
<Andriamanitra> all of overloads join things
<FromGitter> <ImAHopelessDev_gitlab> their parameters lmao
<FromGitter> <ImAHopelessDev_gitlab> it's all different
<FromGitter> <Blacksmoke16> that doesnt change what the method does
<FromGitter> <Blacksmoke16> it join things
<FromGitter> <ImAHopelessDev_gitlab> ?
<FromGitter> <Blacksmoke16> whether it takes just the separator, or the separator and an io
<FromGitter> <Blacksmoke16> both are just joining each element by the separator
<FromGitter> <ImAHopelessDev_gitlab> if it needs to take an io, should have another method
<FromGitter> <Blacksmoke16> the former just returns a string result, while the latter writes the data to the io
<FromGitter> <Blacksmoke16> i disagree, its a great pattern to define the io version first then just use `String.build` as the io for the string result
<FromGitter> <Blacksmoke16> which is how join is implemented
<FromGitter> <ImAHopelessDev_gitlab> i mean ur point makes sense, but to me it seems to make more sense ot have separate methods
<FromGitter> <Blacksmoke16> doesnt that make it harder to remember the specific names of what exact thing you want versus just remembering "i want to join things"
<Andriamanitra> + it leads to java style method names that are at least two miles long
gangstacat has joined #crystal-lang
<FromGitter> <naqvis> Girng I would say Golang suits your style more, no type hierarchy, no overloading :P
<Andriamanitra> ok possibly really stupid question but is []= the only special case where you can write something similar to "obj.method(args) = newval"?
<FromGitter> <tenebrousedge> special case?
deavmi has quit [Ping timeout: 264 seconds]
<Andriamanitra> i mean that it sets the value and takes arguments on the left side of '='
<FromGitter> <j8r> `some_method=(key)`?
<FromGitter> <j8r> then you can call `some_method = "key"`
<FromGitter> <Blacksmoke16> his point is `[]=` has two args, like `arr[0] = 1` `[]=(idx, value)`
<Andriamanitra> yeah exactly ^
deavmi has joined #crystal-lang
<FromGitter> <j8r> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd3957391e8cb3e8cf575da]
<FromGitter> <j8r> two args, don't know, can it work?
<FromGitter> <Blacksmoke16> yes but that only has 1 arg
<FromGitter> <Blacksmoke16> right, because i think that setter is special?
<Andriamanitra> well the compiler does say "Error: setter method 'set=' cannot have more than one argument", but if []= can do it maybe there are others..?
<FromGitter> <naqvis> you can have multiple args, but two args are mostly norm for index based values
<FromGitter> <j8r> right, just tried
<FromGitter> <Blacksmoke16> i usually switch to like `obj.set_value 1, 2`
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <Blacksmoke16> `[]=` could get confusing if there isnt a key/value, or idx/value pairing
<FromGitter> <Blacksmoke16> or something similar
<FromGitter> <naqvis> agree, that's why compiler is declining that
<Andriamanitra> yeah, true.. so it is the only one?
<FromGitter> <naqvis> but it makes sense for Arrays/Hashes
<FromGitter> <j8r> Little poll: do people here use ad blockers?
<FromGitter> <Blacksmoke16> yes
<Andriamanitra> yes
<FromGitter> <j8r> I thought so, so I'm not wrong here https://github.com/crystal-lang/crystal-book/issues/448#issue-762463733
<FromGitter> <j8r> thanks
<FromGitter> <Blacksmoke16> pretty sure it doesnt block GA tho
<FromGitter> <j8r> Firefox does by default now
<FromGitter> <j8r> *at least
<FromGitter> <Blacksmoke16> rip
<FromGitter> <Blacksmoke16> i find it neat to look at. dont really know anything about marketing and stuff tho :P
<FromGitter> <Blacksmoke16> 4 people looked at the athena docs todays :S
<FromGitter> <anapsix> > Little poll: do people here use ad blockers? ⏎ ⏎ yep, Pi-Hole + Firefox / uBlock
<Andriamanitra> firefox + ublock origin + privacybadger for me
<FromGitter> <j8r> I opened an issue to remove the Google Analytics from https://crystal-lang.org/reference/ :)
<FromGitter> <Blacksmoke16> why?
<FromGitter> <j8r> because it collects biased stats, as you see most of us already block it
<FromGitter> <Blacksmoke16> id be curious to see just how many actually block GA tho
<Andriamanitra> i might very well be the only one here but i think highly of sites that don't trigger the adblocker, even if it's something relatively harmless like GA
<FromGitter> <j8r> plus: ⏎ ⏎ 1) it is used? ⏎ 2) a solutions exist ⏎ 3) it is from Manas (...?!) [https://gitter.im/crystal-lang/crystal?at=5fd398560697c1210db6142f]
<FromGitter> <j8r> *betetr solutions
<FromGitter> <Blacksmoke16> i mean if they're just outright not using it at all, then sure. but idt we're in a positional to tell them that they should do something different just because
<FromGitter> <mwlang> I use brave browser for ad blocking. I haven't seen a Youtube advertisement in so long....
<FromGitter> <j8r> My point is, GH Pages would cost less, provides free analytics, better privacy
<FromGitter> <anapsix> default uBlock origin settings on https://athenaframework.org/ ☝️
<FromGitter> <Blacksmoke16> rip
<FromGitter> <j8r> @anapsix thx! as I was suspecting. I use Privacy Badger + the default in Firefox
<FromGitter> <anapsix> GH Pages can be still have embedded GA code, if so desired
<FromGitter> <Blacksmoke16> ^ thats how mines setup
<FromGitter> <j8r> of course, that's just a static site
<FromGitter> <j8r> why having GA @Blacksmoke16 ?
<FromGitter> <Blacksmoke16> i think its neat to look at
<FromGitter> <j8r> ...you know now that it is biased, likely less than half of your visits have it un blocked
<FromGitter> <Blacksmoke16> so?
<FromGitter> <Blacksmoke16> doesnt change the fact its neat to look at :p
<FromGitter> <j8r> so you can't make decisions on it, because it does not represent the majority of your visitors. It is therefore mainly useless
<FromGitter> <Blacksmoke16> granted idk anything about marketing really so its not like its a critical piece of tech, but having an idea that people are looking it and such is good info to know
<FromGitter> <Blacksmoke16> i mean its not like i would be doing that anyway ha
<FromGitter> <j8r> correction: that's likely the least tech-savvy you have stats
<FromGitter> <j8r> (in general)
<FromGitter> <Blacksmoke16> probably, but so what?
<FromGitter> <j8r> as said before, you can't know the most popular pages for instances
<FromGitter> <j8r> but no worry, there are alternatives that are not blocked
<FromGitter> <Blacksmoke16> looking at logs? :p
<FromGitter> <j8r> other solutions than GA, like matomo
<FromGitter> <j8r> yes or logs or GH Pages
<FromGitter> <anapsix> this thing is pretty neat - https://matomo.org/ - and you can serve it from whatever domain, when self-hosting.. ofcourse you'd have to host it somewhere, but a small $5/$10 per month DO instance would probably be enough
<FromGitter> <Blacksmoke16> sure but thats a lot of work and $ compared to something i had to do essentially no work on and is free
<FromGitter> <j8r> @Blacksmoke16 note you can already know popular pages wit GitHub
<FromGitter> <Blacksmoke16> nor do i really intend on using
<FromGitter> <anapsix> true, I wish there'd be a privacy minded publicly usable analytics platform
<FromGitter> <anapsix> cloudflare provides some analytics, btw ⏎ though it's somewhat limited
<FromGitter> <j8r> Anyway, I don't mind. Just saying it is useless, you said yourself you don't do anything, so shrug :)
<FromGitter> <j8r> for Crystal, I'm mainly curious since a long time if it is really used to justify its presence.
<FromGitter> <j8r> If core members look at it to improve the site, I'm 100% fine!
<FromGitter> <anapsix> would be cool to have those stats published
<oz> oops, forgot I had to register to watch the free crystal conf. 🤔
<FromGitter> <anapsix> 😢
<straight-shoota> oz, you can watch on Youtube: https://www.youtube.com/watch?v=GzO3daoiTzM
<oz> straight-shoota: oh, I think I'll do that then. Thank you sir. :)
<straight-shoota> You can also still join the zoom call at https://us02web.zoom.us/webinar/register/WN_5KVXjD7BTqOpT55P5nDXzA
<straight-shoota> and track2 is about to start soon at https://us02web.zoom.us/s/85045467875?pwd=cFloOTZ2dU82N0Q4ZitSSXMrUloyUT09
<yxhuvud> oh great, hadn't seen the link for track2 anyhwere
<straight-shoota> it hasn't started yet, so I suppose it will be communicated after the keynote has finished
f1reflyylmao is now known as f1refly
<FromGitter> <j8r> @anapsix 💯
<straight-shoota> for completeness, this is the youtube link for track2: http://www.youtube.com/watch?v=WVk8Wstc5Zw
<FromGitter> <anapsix> thank you!
<FromGitter> <asterite> @Blacksmoke16 way to go!
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <asterite> On the Crystal Raw Conference Kirk is saying he is using Athena for a really interesting project, and praising it
<FromGitter> <Blacksmoke16> ah nice 😊 good to hear
<FromGitter> <Blacksmoke16> oh nice, i didnt know it was open source
robacarp has joined #crystal-lang
<Andriamanitra> my solutions get worse and worse every day https://github.com/Andriamanitra/adventofcode2020/blob/main/day11/solution.cr
<Andriamanitra> i'm way out of my comfort zone with the class stuff so do let me know if i'm doing something stupid before it becomes a habit
<Andriamanitra> i suspect the #each_neighbor method could be implemented without creating intermediate array somehow
<FromGitter> <j8r> Andriamanitra you could pre-build a map of places
<FromGitter> <j8r> each Place class will hold a reference of its neighbors
<FromGitter> <j8r> then put them all on a `Hash(Tuple(Int32, Int32), Place)`
<Andriamanitra> oh that's true since the chairs are not moving
<FromGitter> <j8r> or array like you've done, no need to hash
<FromGitter> <j8r> I have done something like this for my Game, for chunks
<hightower3> The conf should have been promoted more here :)
<oz> hightower3: indeed, great speakers and interesting topics. :)
<FromGitter> <watzon> I totally forgot about it until like 10 minutes ago. Gonna try and catch the 2nd half.
<straight-shoota> you can catch up later on Youtube ;)
* raz just tuned in on youtube
<raz> this is awesome! 😍
<hightower3> seconded
<FromGitter> <watzon> Where is the live chat? YouTube chat isn't showing anything
<FromGitter> <Daniel-Worrall> Zoom
<FromGitter> <watzon> Ahhh ok
<straight-shoota> there's a conference discord: https://discord.com/channels/783832262806470706/786383342819475488
<straight-shoota> lot of activity there
<oprypin> straight-shoota, i dont think that link can work as the initial invite
<FromGitter> <watzon> I found an invite on the Crystal discord
<FromGitter> <watzon> Thanks :)
<FromGitter> <watzon> For anyone else https://discord.gg/8rmAkWRh
<straight-shoota> discord is weird :/
<oprypin> yes
<yxhuvud> apart from the f-g disconnect button, weird how?
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 272 seconds]
o5r has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<FromGitter> <kingsleyh> Was a great conf - some really good sessions
<FromGitter> <kingsleyh> @wontruefree great panel discussion - wish it had have been a bit longer - but being at the end is when you usually get squashed and even sometimes completely cut - so time keeping was pretty good overall
<liteyear> Just finished catching up on Massimiliano’s tools conference presentation. Great to see the challenges getting an IDE set up were acknowledged.
<liteyear> I’m up and running with VS Code, but do have one niggling pain remaining: when running the Build Task (⌘⇧B) VS Code complains that The task provider for "crystal" tasks unexpectedly provided a task of type "shards”.
<liteyear> Apparently this is an issue in an extension’s call to registerTaskProvider: https://github.com/microsoft/vscode-cpptools/issues/5388
<liteyear> So is this an issue in crystal-lang-tools.crystal-lang ?
<Andriamanitra> i use code-runner with vscode for running files, it lets you set up a custom command per language
<Andriamanitra> i'm sure there's also way to set up build tasks but it seems complicated to me :D