ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | 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
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
ma__ has joined #crystal-lang
ma__ has quit [Client Quit]
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
f1refly has quit [Ping timeout: 250 seconds]
f1refly has joined #crystal-lang
Nekka has quit [Ping timeout: 265 seconds]
Nekka has joined #crystal-lang
* FromGitter * igor-alexandrov waves "Hello"
<FromGitter> <igor-alexandrov> Based on my pull request https://github.com/crystal-lang/crystal/pull/8345 I wanna pay my attention to CSV class. What do you think should be added? Currently I have two ideas: add an option that will apply String#presence to each field or add `converters` options that will work like in Ruby CSV https://docs.ruby-lang.org/en/2.6.0/CSV.html. What do you think?
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 276 seconds]
ht_ has joined #crystal-lang
<FromGitter> <vlazar> What do you mean by ⏎ ⏎ > add an option that will apply String#presence to each field ⏎ ⏎ `String#presense` is already a thing in crystal-lang/crystal#8345 [https://gitter.im/crystal-lang/crystal?at=5dae8c44a03ae1584fe7d71c]
<FromGitter> <ImAHopelessDev_gitlab> Awww CSV, my dear friend
ht_ has quit [Quit: ht_]
absolutejam2 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
absolutejam2 has quit [Ping timeout: 245 seconds]
<FromGitter> <igor-alexandrov> @vlazar I mean that I wanna add this option to `CSV.new`, `CSV.parse` and `CSV.each_row`
teardown is now known as someone
someone is now known as teardown
flaviodesousa has joined #crystal-lang
absolutejam2 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 276 seconds]
dwdv has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 265 seconds]
absolutejam2 has joined #crystal-lang
<FromGitter> <vlazar> @igor-alexandrov Because of many options CSV.new API in Ruby is huge https://docs.ruby-lang.org/en/2.6.0/CSV.html#method-c-new ⏎ I wonder if this should be copied to Crystal or a more modular solution would be a better experience.
<FromGitter> <vlazar> Maybe Ruby's API grew from 1-2 options by gradually adding 1 more useful option and now it is what it is.
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 250 seconds]
<FromGitter> <lbarasti> Looking at the `select` statement, should `Channel#receive?` be supported, too? In other words, should `receive_select_action?` exist?
absolutejam2 has quit [Ping timeout: 240 seconds]
absolutejam2 has joined #crystal-lang
<FromGitter> <igor-alexandrov> @vlazar good point. What do you mean by modular solution?
<FromGitter> <firejox> @lbarasti 👍
duane has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 276 seconds]
<FromGitter> <vlazar> @igor-alexandrov At least not sticking all options in single method. Maybe find some options that makes sense to group, extract to separate classes where it makes sense/doesn't hurt performance.
duane has joined #crystal-lang
fifr[m] has quit [Remote host closed the connection]
beepdog has quit [Read error: Connection reset by peer]
ternarysolo has quit [Read error: Connection reset by peer]
olbat[m] has quit [Remote host closed the connection]
erdnaxeli has quit [Remote host closed the connection]
vegai has quit [Remote host closed the connection]
absolutejam2 has quit [Ping timeout: 240 seconds]
absolutejam2 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
Human_G33k has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
HumanGeek has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> good morning
<FromGitter> <kinxer> Mornin', Girng.
<FromGitter> <ImAHopelessDev_gitlab> :)
absolutejam2 has quit [Ping timeout: 246 seconds]
ht_ has joined #crystal-lang
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
<FromGitter> <wontruefree> Does Crystal's GC have memory compression?
DTZUZO has joined #crystal-lang
alexherbo201 has joined #crystal-lang
alexherbo20 has quit [Ping timeout: 245 seconds]
alexherbo201 has quit [Ping timeout: 246 seconds]
<Yxhuvud> wontruefree: No.
alexherbo201 has joined #crystal-lang
<Yxhuvud> Also it is quite hard to arrange with a conservative GC.
dwdv has quit [Ping timeout: 240 seconds]
alexherbo201 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <wontruefree> I was looking into mesh and was curious if you could implement it in Crystal
<FromGitter> <kinxer> What is "mesh"?
<FromGitter> <wontruefree> it is a malloc replacement https://github.com/plasma-umass/mesh
<FromGitter> <wontruefree> from umass
<FromGitter> <wontruefree> my understanding is if you only use malloc and free it can do a lot of cool stuff
<FromGitter> <wontruefree> if you use mmap or anything else I think it can be a problem
<FromGitter> <wontruefree> looks like boehm might implement their own malloc
<FromGitter> <kinxer> Interesting.
<FromGitter> <wontruefree> yeah it is a really cool project
<Yxhuvud> wontrufree: It might well be possible to implement mesh, and having a unified memory system that handles both allocation and garbage and reuses structures between them might have some nice synergies.
<FromGitter> <wontruefree> they have used it on firefox and some other big projects
<FromGitter> <wontruefree> dont know who has adopted it
<FromGitter> <wontruefree> Yxhuvud do you think it would have to be implemented in the boehm project
<Yxhuvud> Either that or replace it. :shrug:.
<Yxhuvud> I doubt boehm reimplements malloc. It is likely just a wrapper around malloc so that they can keep track of what is allocated
<Yxhuvud> Could be wrong though.
<FromGitter> <wontruefree> I am look through it now but I dont know yet
<FromGitter> <lbarasti> ideas for a macro-based pipe operator à la clojure/elixir?
<FromGitter> <tenebrousedge> why a macro? and what would that let you do that you can't do already?
<FromGitter> <lbarasti> like ⏎ ⏎ ```item1 |> do_this(item2) |> do_that``` [https://gitter.im/crystal-lang/crystal?at=5daf47bdf26ea4729dd77fa5]
<FromGitter> <lbarasti> looks like a macro job to me :D
<FromGitter> <lbarasti> that wouldn't let you do anything you can already do 👍
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter> <kinxer> Can you have a macro that operates on a token before it?
<FromGitter> <tenebrousedge> I would just implement `Object#then`
<FromGitter> <tenebrousedge> a la Ruby
<FromGitter> <tenebrousedge> I think it's just: ⏎ ⏎ ```class Object; def then; yield self; end; end;``` [https://gitter.im/crystal-lang/crystal?at=5daf48e17477946badaf24a0]
<FromGitter> <tenebrousedge> `item1.then &.do_this.then &.do_that`
<FromGitter> <lbarasti> interesting @tenebrousedge
<FromGitter> <lbarasti> > Can you have a macro that operates on a token before it? ⏎ ⏎ investigating that
dwdv has joined #crystal-lang
<FromGitter> <asterite> you can't implement the pipe operator with that syntax in current crystal
<FromGitter> <lbarasti> mhmhm, this is something I've noted before, that the semantic step of the compiler happens before the expansion. I feel like that limits the range of things we can do quite a lot
<FromGitter> <tenebrousedge> @asterite has anyone suggested adding `then` to Crystal?
<FromGitter> <lbarasti> for example, even implementing something like ⏎ ⏎ ```Error: wrong number of arguments for 'pipe' (given 0, expected 1)``` [https://gitter.im/crystal-lang/crystal?at=5daf4bc3a03ae1584fed8630]
<FromGitter> <lbarasti> @asterite would it make sense to experiment with positioning the macro expansion step *before* the semantic step?
<FromGitter> <lbarasti> > you can't implement the pipe operator with that syntax in current crystal ⏎ ⏎ Thanks, I'm sure this is not the first time you have to answer this question XD
<FromGitter> <kinxer> This is all I've got: https://play.crystal-lang.org/#/r/7ust
<FromGitter> <lbarasti> @kinxer `Object#then` reads all right, actually
<FromGitter> <kinxer> ```code paste, see link``` ⏎ ⏎ `do_that(do_this(first, second))` is still the best, IMO. [https://gitter.im/crystal-lang/crystal?at=5daf4da8fb4dab784ae7add3]
<FromGitter> <tenebrousedge> I like `then` in some cases
<FromGitter> <kinxer> `then` seems fine if you're calling a method on `first`, but it gets cumbersome if you're calling methods that take `first`.
sagax has quit [Ping timeout: 240 seconds]
<FromGitter> <tenebrousedge> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5daf4e81a3f0b178496cffc7]
<FromGitter> <lbarasti> Wait, have we just re-implemented `tap`?
<FromGitter> <kinxer> Yes.
<FromGitter> <lbarasti> XD\
<FromGitter> <kinxer> `then` just reads more like natural English, I think.
<FromGitter> <tenebrousedge> `tap` returns the object it's called on rather than the result of the block
<FromGitter> <lbarasti> pipe looks very verbose due to the functions being defined as `def`, but I guess things would look nicer with Procs?
<FromGitter> <lbarasti> good point @tenebrousedge
<FromGitter> <kinxer> Ah, yes. That's true.
<FromGitter> <lbarasti> Just a note that ⏎ ⏎ ``` def +(proc, *args) ⏎ proc.call(self, *args) ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5daf4f1be1c5e91508b6b525]
duane has quit [Ping timeout: 245 seconds]
<FromGitter> <lbarasti> would get us somewhere, if everything was a Proc
<FromGitter> <kinxer> `Proc`s are generic (so that their argument types are specified), which makes them more verbose.
<FromGitter> <kinxer> Also, `first.pipe(->do_this(String, String), second)` doesn't really read like `second` will be passed to `do_this`.
<FromGitter> <lbarasti> all right folks, I withdraw my intention, I'll stick to the norm. Thanks for the exploratory session :)
<FromGitter> <kinxer> Yeah, I think that may just not be a crystalline (crystallic? crystomatic? facetious?) way of writing code.
<FromGitter> <tenebrousedge> I mean, I don't think there's anything inherently wrong with the idea. Obviously the specific syntax is a no-go
<FromGitter> <tenebrousedge> I'd definitely support `Object#then`
<FromGitter> <kinxer> Right, but the difference is that it seems like `|>` changes how methods are interpreted after it (e.g. `first |> do_this(second)` re-interprets `second` as the second argument and `first` as the first). That seems outside of the behavior I'd ever expect from Crystal.
<FromGitter> <tenebrousedge> yes, it makes more sense in Elixir
<FromGitter> <lbarasti> I wouldn't say it's something Elixir specific. Clojure does it, `sh` does it. It's just that I don't see that happening without macro support
<FromGitter> <tenebrousedge> `sh` does what now?
<FromGitter> <lbarasti> I'm thinking of `|`, is that wrong?
<FromGitter> <tenebrousedge> in practice, probably not
duane has joined #crystal-lang
dwdv has quit [Ping timeout: 246 seconds]
<FromGitter> <absolutejam_twitter> Well it works completely differently in sh
<FromGitter> <absolutejam_twitter> I always loved how powershell did it
<FromGitter> <absolutejam_twitter> Super flexible
<FromGitter> <tenebrousedge> if powershell were less verbose it would be very interesting
<FromGitter> <absolutejam_twitter> Elixir and clojure threading are nice if you have consistent function signatures
<FromGitter> <absolutejam_twitter> You can make it so but yeah, just the wus it is
<FromGitter> <absolutejam_twitter> Was a Windows sysdmin so I really liked it
<FromGitter> <absolutejam_twitter> I was thinking about this earlier funnily enough and a `then` method came to mind
<FromGitter> <absolutejam_twitter> Is that in Ruby?
<FromGitter> <absolutejam_twitter> Would you architect it to stop at `nil`s or something?
<FromGitter> <tenebrousedge> yes, it's in Ruby. No, `nil` is a valid value
<FromGitter> <tenebrousedge> if you wanted you could do `then &.not_nil!.then `
<FromGitter> <tenebrousedge> it really is just `yield self`
<FromGitter> <absolutejam_gitlab> ah fair enough, just for chaining then
<FromGitter> <absolutejam_gitlab> wait, is that different to `tap`?
<FromGitter> <tenebrousedge> `tap` is `yield self; self`
absolutejam2 has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> I really like Elixir's `with` statement to
<FromGitter> <absolutejam_gitlab> https://www.openmymind.net/Elixirs-With-Statement/
<FromGitter> <tenebrousedge> hmm
<FromGitter> <tenebrousedge> is that necessary in Crystal?
<FromGitter> <absolutejam_gitlab> Not really, or perhaps not that exactly
<FromGitter> <absolutejam_gitlab> I just like the railroad style of transformation/validation chain with a break-out clause
<FromGitter> <absolutejam_gitlab> But that works a lot better in a functional language
<FromGitter> <tenebrousedge> Crystal has first-class functions
<FromGitter> <tenebrousedge> what would a Crystalline example of `with` look like?
<FromGitter> <absolutejam_gitlab> Probably just method chaining but with a try catch wrapping it? 😆
<FromGitter> <absolutejam_gitlab> My brain seems to default to pattern matching and piping, but that's bolstered by immutability and proper pattern matching
<FromGitter> <absolutejam_gitlab> Not sure if it's a case of 'wow, we can make Crystal super flexible and accommodate other styles' or 'how can we conflate this language?'
<FromGitter> <absolutejam_gitlab> I'm coming round to the `&.foo` syntax a little
<FromGitter> <absolutejam_gitlab> The thing with proper piping, is that it relies on pure functions like `String.upcase("foo")` instead of methods `"foo".upcase`
<FromGitter> <tenebrousedge> yes
<FromGitter> <tenebrousedge> eso no me gusta
<FromGitter> <absolutejam_gitlab> somebody go implement them all please
<FromGitter> <tenebrousedge> D:
<FromGitter> <absolutejam_gitlab> Looking into Elm at the same time so I'm in that mode
<FromGitter> <tenebrousedge> have you evaluated Opal?
<FromGitter> <absolutejam_gitlab> the SQL-style comma on the next line thing is weird
<FromGitter> <absolutejam_gitlab> but I get it. It's just ugly
<FromGitter> <absolutejam_gitlab> never heard of it
<FromGitter> <tenebrousedge> It's a Ruby-to-JS transpiler https://github.com/opal/opal
<FromGitter> <absolutejam_gitlab> jesus christ Elm is weird
<FromGitter> <absolutejam_gitlab> is it a lisp
<FromGitter> <absolutejam_gitlab> is it js
<FromGitter> <absolutejam_gitlab> what is it
<FromGitter> <meltheadorable> opal 😒
ht_ has quit [Remote host closed the connection]
<FromGitter> <tenebrousedge> I wasn't a big fan of PHP-to-JS transpilation, when I encountered it. But Ruby has pretty flexible syntax. If it were a choice between React/Typescript and Opal...
<FromGitter> <absolutejam_gitlab> also, fuck Medium's paywall
<FromGitter> <absolutejam_gitlab> why do people use Medium
sagax has joined #crystal-lang
<FromGitter> <meltheadorable> project itself is whatever, but the dev team is total jerks, i wouldn’t want to need to interact with the project or it’s community because of it
<FromGitter> <meltheadorable> which makes opal a nonstarter for me
<FromGitter> <tenebrousedge> oh?
<FromGitter> <kinxer> @absolutejam_gitlab Looks like there's only a paywall if the author chooses to have one (https://help.medium.com/hc/en-us/articles/360018834314-Stories-that-are-part-of-the-metered-paywall).
<FromGitter> <absolutejam_gitlab> Is that the thing you see when you've read a few?
<FromGitter> <absolutejam_gitlab> You can get round it by going incognito but it's just stupid
<FromGitter> <meltheadorable> its main contributor posted a bunch of anti-LGBT rants all over twitter a couple years back, and one of the main contributors at the time went off about it and started evangelizing against codes of conduct and etc, they adopted a code of conduct briefly at the behest of the repo owner, then promptly undid it and replaced it with one that doesn’t actually include any anti-discrimination language
<FromGitter> <meltheadorable> walking disaster
<FromGitter> <tenebrousedge> thank you for the information, I'll cross it off my list
<FromGitter> <meltheadorable> yeah it’s unfortunate, interesting project on a technical level, but that kind of infrastructure IMO i’d need to feel comfortable interacting with the devs and community to get help/support and the devs and community decided to make their project unsafe to participate in
<FromGitter> <kinxer> @absolutejam_gitlab ⏎ ⏎ > Medium will never meter a story without the writer’s permission. ⏎ and ⏎ > If my story is eligible to be part of the paywall, will Medium always show a paywall? ... [https://gitter.im/crystal-lang/crystal?at=5daf6b1710bd4128a1425433]
absolutejam2 has quit [Ping timeout: 252 seconds]
<FromGitter> <alehander42> @meltheadorable i really think this is not fair from you: opal is a fine project, and the tweets i found were perfectly reasonable to me
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 246 seconds]
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
vegai has joined #crystal-lang
vegai has quit [Ping timeout: 245 seconds]
vegai has joined #crystal-lang
olbat[m] has joined #crystal-lang
erdnaxeli has joined #crystal-lang
ternarysolo has joined #crystal-lang
beepdog has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang