ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.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 [Ping timeout: 248 seconds]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
snsei has joined #crystal-lang
thews has quit [Ping timeout: 240 seconds]
snsei has quit [Ping timeout: 248 seconds]
thews has joined #crystal-lang
binBASH has quit [Ping timeout: 276 seconds]
binBASH has joined #crystal-lang
andrewzah has joined #crystal-lang
andrewzah has quit [Quit: ZNC 1.6.5 - http://znc.in]
andrewzah has joined #crystal-lang
andrewzah has quit [Quit: ZNC 1.6.5 - http://znc.in]
<crystal-gh> [crystal] MakeNowJust opened pull request #4949: Replace 'name_table.fetch(i) { i }' with 'name_table.fetch(i, i)' (master...fix/regex-match-data/name-table-fetch) https://git.io/v5PrC
weston has joined #crystal-lang
weston is now known as wes[phi]
<crystal-gh> [crystal] MakeNowJust opened pull request #4950: Disallow to assign instance/class variable outside method dynamically (master...fix/crystal/toplevel-ivar-assign) https://git.io/v5PK4
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
wes[phi] has quit [Ping timeout: 240 seconds]
andrewzah has joined #crystal-lang
<FromGitter> <codenoid> how i can execute shell command "``" without waiting exited output from that command
sp4rrow has joined #crystal-lang
thews has quit [Ping timeout: 248 seconds]
<crystal-gh> [crystal] MakeNowJust closed pull request #4950: Disallow to assign instance/class variable outside method dynamically (master...fix/crystal/toplevel-ivar-assign) https://git.io/v5PK4
<FromGitter> <bararchy> @codenoid Process.new
<FromGitter> <bararchy> Also fibers , fork , etc..
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <codenoid> thanks @bararchy , work with Fibers ✨
<crystal-gh> [crystal] MakeNowJust opened pull request #4951: Disallow to assign instance variabls inside nested expressions (master...fix/crystal/toplevel-nested-ivar-assign) https://git.io/v5PPP
Rinkana has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <renich> Hey guys! o/
<FromGitter> <renich> Just wanted to report that crystal no longer compiles on Gentoo since it migrated to LLVM 5
<FromGitter> <renich> I can share output, but I think it's pointless
<FromGitter> <renich> It is slotted and you could go for v4, which works fine with crystal, but the point is, I am sure, other distros will follow and they may not offer v4 anymore.
* FromGitter * renich is back to binary version...
Papierkorb_ has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <krypton97> Morning all
<FromGitter> <bararchy> Sup :0
<Papierkorb_> Yo
flaviodesousa has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
mark_66 has joined #crystal-lang
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewzah> renich what's the output?
claudiuinberlin has joined #crystal-lang
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> Morning everyone
baweaver has quit [Ping timeout: 255 seconds]
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
baweaver has joined #crystal-lang
justinmcp has joined #crystal-lang
baweaver is now known as Guest52630
<FromGitter> <straight-shoota> Good morning
<FromGitter> <krypton97> Sup
<Groogy_> Morning!
Groogy has quit [Disconnected by services]
Groogy_ is now known as Groogy
rohitpaulk has joined #crystal-lang
Groogy2 has joined #crystal-lang
codenoid has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <bararchy> Morning :)
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <Qwerp-Derp> Is it possible to call Swift code from Crystal?
claudiuinberlin has joined #crystal-lang
<FromGitter> <krypton97> interesting since swift is also llvm based
<FromGitter> <Qwerp-Derp> It's possible to call Crystal code from Swift, but I'm not really sure about if it's possible the other way round
bmcginty has quit [Ping timeout: 252 seconds]
bmcginty has joined #crystal-lang
<FromGitter> <Qwerp-Derp> I'm also thinking of making a clone of Clojure in Crystal
<Papierkorb_> Nothing much to do with LLVM (Sadly, that doesn't help in any way :|), but in theory you can call anything from anything. Manually writing such bindings can be awkward though.
<Papierkorb_> But as Swift -> Crystal already exists (?), the other way around will be possible too. The grunt work of figuring out how to bind at all is "done"
ShalokShalom_ has joined #crystal-lang
ShalokShalom has quit [Ping timeout: 248 seconds]
codenoid has quit [Quit: This computer has gone to sleep]
codenoid has joined #crystal-lang
codenoid has quit [Client Quit]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Papierkorb__ has joined #crystal-lang
Papierkorb_ has quit [Ping timeout: 240 seconds]
Philpax__ has joined #crystal-lang
Philpax__ has quit [Ping timeout: 240 seconds]
Rinkana has joined #crystal-lang
<FromGitter> <matrixbot> `@Renich:matrix.org` @andrewza: it seems it's a duplicate bug.
claudiuinberlin has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v5Xti
<crystal-gh> crystal/master acc40a0 TSUYUSATO Kitsune: Replace 'name_table.fetch(i) { i }' with 'name_table.fetch(i, i)'
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<travis-ci> crystal-lang/crystal#acc40a0 (master - Replace 'name_table.fetch(i) { i }' with 'name_table.fetch(i, i)'): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/274144136
<FromGitter> <krypton97> any hack to send an image to the client via sockets
<FromGitter> <krypton97> ?
ShalokShalom_ is now known as ShalokShalom
<crystal-gh> [crystal] RX14 closed pull request #4951: Disallow to assign instance variabls inside nested expressions (master...fix/crystal/toplevel-nested-ivar-assign) https://git.io/v5PPP
codenoid has joined #crystal-lang
codenoid has quit [Client Quit]
<FromGitter> <fridgerator> you can send the base64 encoded strings, but in my experience sending large messages like that over websockets is a bad idea
<FromGitter> <fridgerator> its usually better to just send an image link instead
Yxhuvud has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#177028e (master - Disallow to assign instance variabls inside nested expressions (#4951)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/274161743
<DeBot_> https://github.com/crystal-lang/crystal/pull/4951 (Disallow to assign instance variabls inside nested expressions)
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <krypton97> right
sp4rrow has joined #crystal-lang
Papierkorb__ has quit [Ping timeout: 240 seconds]
<Rinkana> I have a singleton class but instead of the object itself i want to return the pointer. However i keep getting different pointers or a pointer to a union type while it should be just the class itself: https://play.crystal-lang.org/#/r/2pgs
<Rinkana> Any ideas to return the pointer by default?
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
codenoid has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <asterite> Don't use pointerof! It's unsafe. You can't return `pointerof`, it will crash your program
<FromGitter> <bararchy> .to_unsafe ? XD
Papierkorb__ has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
flaviodesousa has quit [Remote host closed the connection]
<FromGitter> <codenoid> @matrixbot are you @FromIRC friend ?
<FromGitter> <faustinoaq> > I've some high scale APIs running for more than 1 year without any restarts ... [0] ⏎ ⏎ [0] - https://dev.to/crystal-lang/we-created-the-crystal-language-ask-us-anything/comments/lpa ⏎ ⏎ Hi @sdogruyol I think you should write something like "12 Months of Crystal in Production". I taken the idea from here 👉 https://www.youtube.com/watch?v=AdY5AfXs7aw&t=3261s
<FromGitter> <faustinoaq> > @matrixbot are you @FromIRC friend ? ⏎ ⏎ 😆
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <drujensen> https://www.tiobe.com/tiobe-index/
<FromGitter> <drujensen> crystal - 31, rust - 49
<FromGitter> <asterite> lol, that index is totally flawed
<FromGitter> <faustinoaq> Wow, Thanks for share this 👍
<FromGitter> <drujensen> @asterite it may be flawed but its the one most used. ;-) perception is reality.
<FromGitter> <drujensen> matrix like..lol
<FromGitter> <faustinoaq> > lol, that index is totally flawed ⏎ ⏎ Yeah, RX14 commented something about this some time ago https://www.reddit.com/r/crystal_programming/comments/6rt7k3/crystal_jumped_from_position_60_to_32_in_aug_2017/dl7lqno/ ⏎ ⏎ @drujensen I think the same 😄 [https://gitter.im/crystal-lang/crystal?at=59b69a33319100804e1fcc7c]
<RX14> any index which has crystal higher than rust is clearly flawed
sz0 has joined #crystal-lang
<FromGitter> <drujensen> @faustinoaq thanks for the reddit post. I guess this is old news. I found it funny to see crystal way ahead of rust. I just saw a post from a Java community debating is python was really moving up and they used this index as their proof.
<FromGitter> <asterite> And Elixir is after the first 50. Makes no sense at all. Elixir is years ahead of Crystal and Rust.
<FromGitter> <drujensen> aaaahh, i know why
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <drujensen> they are measuring based on queries to google using <lang> + programming
<FromGitter> <drujensen> since crystal is not unique enough, we tend to always include programming in our query strings
<FromGitter> <drujensen> elixer and rust are unique enough that it doesn’t require programming
Papierkorb__ has quit [Quit: Konversation terminated!]
<FromGitter> <drujensen> so, all we need to do is keep searching google with `crystal programming` to bump up our rating. lol.
<RX14> rust is probably much more generic than crystal as a word
<FromGitter> <drujensen> hhmm, true
<RX14> the thing is that crystal programming already exists as a weird occult term
<RX14> google it yourself
<FromGitter> <sdogruyol> yeah
<FromGitter> <sdogruyol> crystal reports
<FromGitter> <faustinoaq> So Crystal is cheating here, but does good marketing . ⏎ ⏎ However, I think Crystal community can reach a good popularity in the next years as result of all our effort 😉
claudiuinberlin has joined #crystal-lang
<FromGitter> <sdogruyol> agreed 👍
<FromGitter> <sdogruyol> It's not just the community, Crystal too :P
<FromGitter> <faustinoaq> Yeah 💪
<FromGitter> <sdogruyol> quite off-topic but does anyone got segfaults when trying to use Ruby 2.4.x on Arch x64
<FromGitter> <faustinoaq> And Elixir is after the first 50. Makes no sense at all. Elixir is years ahead of Crystal and Rust. ⏎ ⏎ @asterite Did you use Elixir in some project? What do you think Crystal can learn from Elixir?
<FromGitter> <faustinoaq> > quite off-topic but does anyone got segfaults when trying to use Ruby 2.4.x on Arch x64 ⏎ ⏎ No, at least on Manjaro
Rinkana has quit [Ping timeout: 260 seconds]
<FromGitter> <sdogruyol> Ruby 2.4.0 is prone to many segfaults
<FromGitter> <krypton97> any news with the techempower issue?
<FromGitter> <krypton97> I mean the benchmarking results on their machine
<FromGitter> <drujensen> @krypton97 I haven’t been able to reproduce the issue. @elorest and I have tried several times but we are not getting the 10x slower results. We haven’t been able to test on a similar 80 core system though.
<FromGitter> <drujensen> they require Ubuntu 14.04 and 3 boxes. one client, one server and one db. We were skipping the db since we are only concerned with the `plaintext` and `json` tests
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <krypton97> oh ok
<FromGitter> <drujensen> if someone has an 80 core system just waiting to be used for a benchmark, let me know! ;-)
<FromGitter> <drujensen> or a budget that allows us to spin one up.
<Groogy> meh can pull down our servers for a few hours for you ;D
<Groogy> j/k
<FromGitter> <sdogruyol> haha nice one
<FromGitter> <drujensen> 😄
sp4rrow has quit [Read error: Connection reset by peer]
<Groogy> oh back in the days when our metaserver (server you connected for mp matchmaking before steam) was literally a random old crappy computer standing in a nook
<RX14> i ran a public jenkins on an entirely unknown random ARM devkit from a small company in germany once
<RX14> it didn't run well
<FromGitter> <sdogruyol> you don't mean scaleway right?
<RX14> no...
<RX14> they're french first of all
<RX14> second that's ARM hosting
<FromGitter> <sdogruyol> oh ok
<RX14> and they're really well known
<RX14> this was a physical arm devkit in my room
<RX14> it even had a small TFT display on it
<FromGitter> <asterite> faustinoaq: yes, I used (and use) Elixir at work and it's fantastic. Lessons to learn: keep it simple, and better compile to a VM so you don't have to deal with all the world of libc, posix, etc. :-P, and also being able to compile and interpret macros really fast
<FromGitter> <bararchy> @sdogruyol No sigfaults here
<FromGitter> <bararchy> ``` ⏎ ruby --version ⏎ ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]``` [https://gitter.im/crystal-lang/crystal?at=59b6aa94210ac269201a9b28]
<FromGitter> <sdogruyol> 1) 4.0 just segfaults
<FromGitter> <sdogruyol> 1) 4.1 is OK 👍
Yxhuvud has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
codenoid has quit [Quit: Leaving]
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
Rinkana has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<Rinkana> @asterite i know pointerof is unsafe. But i need the single object and i need it fast. It will be called from many places many times. copying the object will slow it down too much
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bmcginty> I'm working on an ftp library for crystal. I was going to just kind of rewrite the net/ftp lib from ruby propper, but it looks more Convoluted than eerything else in Crystal. For anyoen that might use it, I assume the .list .cd .get .put .close .login and .open should work as interface methods?
<FromGitter> <asterite> Rinkana: it's a class, and classes are already passed by reference. Did you benchmark it first to see if it's slow?
<Rinkana> Not yet, but it's base of C++ code
<Rinkana> But i'll benchmark it first
claudiuinberlin has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<Rinkana> @asterite i've made benchmark. The pointer call is faster: https://play.crystal-lang.org/#/r/2piu
<FromGitter> <faustinoaq> > Lessons to learn: keep it simple, and better compile to a VM ⏎ ⏎ First, Thanks you for your response 😄 ⏎ Second, Could exist some way to compile crystal to bytecode and use a VM ? or Maybe something like JIT for Crystal ? ⏎ ... [https://gitter.im/crystal-lang/crystal?at=59b6bc49210ac269201b0999]
<FromGitter> <jose-rodrigues> @faustinoaq Well There is probably a way to output llvmIR to java bytecode
<FromGitter> <faustinoaq> Third and finally, @asterite Do you give me permission to tweet this 👇 ? ⏎ ⏎ > faustinoaq: yes, I used (and use) Elixir at work and it's fantastic. Lessons to learn: keep it simple, and better compile to a VM so you don't have to deal with all the world of libc, posix, etc. :-P, and also being able to compile and interpret macros really fast ⏎ ⏎ I'm now interested on learn more Functional
<FromGitter> ... paradigm and Elixir 😄 (keeping Crystal in my heart ❤️ of course) [https://gitter.im/crystal-lang/crystal?at=59b6bd26c101bc4e3ab38c60]
<FromGitter> <faustinoaq> > Well There is probably a way to output llvmIR to java bytecode ⏎ ⏎ @jose-rodrigues Oh, interesting, I also see something about Java Native Bindings for Crystal some time ago 👉 https://github.com/ysbaddaden/java.cr
hightower3 has joined #crystal-lang
hightower4 has quit [Ping timeout: 260 seconds]
<FromGitter> <Rinkana> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6c1b7b59d55b823e278e5]
<FromGitter> <Rinkana> Hmm
<Yxhuvud> rinkana: How about you do it with an instance that isn't stored in a class variable?
<FromGitter> <Rinkana> @Yxhuvud this is the current bencmark: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6c2dc614889d475e55b4a]
<Yxhuvud> you are adding a useless indirection that won't be optimized away
<FromGitter> <Rinkana> Yeah. But i'm trying to be as close to the performance of the direct call
<Yxhuvud> .. you are comparing a direct call to an extra pointer dereference followed by a call.
<RX14> ^
<RX14> also this is on the ns range of microbenchmarks
<RX14> it's very unlikely that you'd need this leven of performance
<RX14> it's entremely likely you are overoptimizing this for no gain
<RX14> while the true hotspot in your application remains, and is not optimised, because you havent profiled it
<FromGitter> <Rinkana> It's for a game engine. So i'm trying to get every performance i get
<FromGitter> <Rinkana> But 300M+ calls will probably be sufficient for now
<RX14> you can't get every performance
<RX14> its impossible
<RX14> it's not even close to possible
<RX14> that is why we profile
<RX14> b
<RX14> s/b//
Guest52630 is now known as baweaver
baweaver is now known as Guest58799
Groogy2 has quit [Quit: WeeChat 1.9]
<FromGitter> <faustinoaq> @Rinkana You should read this 👉 https://crystal-lang.org/docs/guides/performance.html ⏎ ⏎ And specially this: ⏎ ⏎ > We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. [https://gitter.im/crystal-lang/crystal?at=59b6ca59bac826f054a4dd1a]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v5XNU
<crystal-gh> crystal/master f9237fd Ary Borenszweig: Introduce Crystal::Hasher for computing a `hash` value
<FromGitter> <georgeu2000> The following throws an error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6d020210ac269201b7863]
<FromGitter> <georgeu2000> Should I file a issue on Github?
<FromGitter> <georgeu2000> `in /usr/local/Cellar/crystal-lang/0.23.1/src/enumerable.cr:744: no overload matches 'Int32#>' with type (Int32 | Iterator::Stop)`
<FromGitter> <georgeu2000> Seems to be coming from `flatten`.
<FromGitter> <georgeu2000> Should I file an issue on Github?
<FromGitter> <bew> Can you show the full error?
<FromGitter> <bew> Also, can you explain what you're trying to do?
<FromGitter> <georgeu2000> OK
<FromGitter> <georgeu2000> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6d0d9210ac269201b7b60]
<travis-ci> crystal-lang/crystal#f9237fd (master - Introduce Crystal::Hasher for computing a `hash` value): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/274276830
<FromGitter> <georgeu2000> `lines` is an array of arrays.
<FromGitter> <georgeu2000> lines is `[[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8], [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0], ...`
<oprypin> pls dont file an issue :p
<FromGitter> <georgeu2000> The above code emits an array of arrays, and flatten converts it to an array of Int32.
<FromGitter> <georgeu2000> `#max` does work as expected with other arrays.
<FromGitter> <georgeu2000> But not after `#flatten`.
<FromGitter> <georgeu2000> So, I thought it might be an issue with Crystal.
<FromGitter> <georgeu2000> I just started using it and thought it might be helpful to issue. I would like to know the best way I can help.
<FromGitter> <georgeu2000> I can create a simplified version to reproduce the issue, if that is helpful.
<FromGitter> <georgeu2000> I don't know if it might be expected behavior, or some other reason that it is not a bug.
RX14 has left #crystal-lang ["Leaving"]
RX14 has joined #crystal-lang
<FromGitter> <bew> I don't think it's a bug of Crystal, but more with your code/logic. I didn't get what you're trying to do with the `each_cons` and `product`
<FromGitter> <bew> are you trying to group lines somehow, and do something with them? what is the goal of this code
<FromGitter> <bew> ?
<oprypin> georgeu2000, https://carc.in/#/r/2pjj - see why it's bad, https://carc.in/#/r/2pji - solution - add .to_a
<FromGitter> <georgeu2000> It is to find the greatest product of 4 consecutive numbers.
<FromGitter> <georgeu2000> Oh, I see.
<FromGitter> <georgeu2000> `#map` emits an iterator.
<oprypin> map called on an iterator emits an iterator
<FromGitter> <georgeu2000> Different from Ruby.
<FromGitter> <bew> `#each_cons` emits an iterator, and `Iterator#map` is also an iterator
<FromGitter> <georgeu2000> Cool.
<FromGitter> <georgeu2000> Glad I didn't waste everyone's time creating an issue.
<oprypin> yeah easier to ask here
<oprypin> sorry for delayed response, i was busy in the background
<FromGitter> <bew> note that I think you can remove `to_a` in `lines.to_a`, as it's already an array
<oprypin> for sure
<FromGitter> <georgeu2000> Yes, I noticed that.
<FromGitter> <georgeu2000> I discovered that I was getting an iterator instead of an array, and thought it was needed at the beginning.
<FromGitter> <georgeu2000> But actually I found the real issue now.
<FromGitter> <georgeu2000> This works as expected:
<FromGitter> <georgeu2000> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6d458319100804e213f62]
<FromGitter> <georgeu2000> No need for `#to_a`.
<FromGitter> <georgeu2000> But this raises the error: `end.to_a.flatten.max`
<FromGitter> <georgeu2000> `in /usr/local/Cellar/crystal-lang/0.23.1/src/enumerable.cr:744: no overload matches 'Int32#>' with type (Int32 | Iterator::Stop)`
<FromGitter> <bew> and as oprypin showed in his example, you can write `.map &.product(1)` instead of `.map{| c | c.product( 1 )}`
<FromGitter> <georgeu2000> OK, thanks. I didn't see that.
<FromGitter> <georgeu2000> I was wondering about how to do it.
<FromGitter> <georgeu2000> `end.to_a.class` is ⏎ `Array(Iterator::Map(Iterator::Cons(Indexable::ItemIterator(Array(Int32), Int32), Int32, Int32), Array(Int32), Int32))`
<FromGitter> <georgeu2000> OK, I see.
<FromGitter> <georgeu2000> BTW, I think Crystal is awesome. How can I help?
<oprypin> one nice consequence of the semantic rule is that you never see `end.something`, which is nice
<FromGitter> <georgeu2000> @oprypin - Can you give me a link for reference?
<oprypin> georgeu2000, talking about https://github.com/crystal-lang/crystal/issues/4504#issuecomment-305982218 but it's not popular
<FromGitter> <georgeu2000> Oh, right. Thanks.
rohitpaulk has quit [Ping timeout: 240 seconds]
<oprypin> mm finally formulated my version of semantic rule - use { } if the block has side effects
<oprypin> what no
<oprypin> mm finally formulated my version of semantic rule - use do...end if the block has side effects, use { } if the block's result is used
<oprypin> the problem with it is that it falls apart when both conditions apply
<FromGitter> <georgeu2000> Hmmm...
<oprypin> so an obvious rule like do...end only for multiline has basically won
<FromGitter> <georgeu2000> What is your idea for compatibility with Ruby? Is it to generally be the same, but make a few changes by design?
bmcginty has quit [Ping timeout: 260 seconds]
<oprypin> how i can try to generalize it: if a ruby way and a non-ruby way both make sense, the ruby way will be chosen
bmcginty has joined #crystal-lang
<oprypin> compatibility is not a goal
<FromGitter> <georgeu2000> I see. Thanks.
<RX14> oprypin, with the multi-line you should never see end.foo
<RX14> because you should assign to a local var
<oprypin> RX14, see georgeu2000's snippet
<oprypin> but sure, thats usually the est
<oprypin> best
<RX14> what  wonder what the downsides of disallowing that syntactically would be
<RX14> oops
<RX14> i wonder what the downsides of disallowing that syntactically would be
<FromGitter> <Fanna1119> ``````
<oprypin> semantic rule would gain followers lol
<RX14> did a backspace and ctrl-i instead of a ctrl-backspace and i
<FromGitter> <Fanna1119> not sure what the docs mean by shift right
<RX14> oprypin, i think the formatter will end up enforcing the multiline rule
<RX14> it already got merged once
<FromGitter> <Fanna1119> like moving the string or object to last ?
<RX14> and reverted because foo bar do/end and foo bar {} isn't the same
claudiuinberlin has joined #crystal-lang
<oprypin> RX14, yeah i'm well aware of that sad fact
<oprypin> just another nail in the coffin of the formatter
<RX14> gofmt is doing fantastically
<RX14> and that's 10x more strict
<RX14> it might be another nail for you
<RX14> but i doubt the formatter will fall out of general usage because of it
<RX14> most people use that rule anyway
<oprypin> Fanna1119, please do not significantly edit messages because they don't get translated to us IRC users
<RX14> it's a much better rule - using arbitrary syntax to convey semantics is a terrible idea
<oprypin> you wrote a bunch of ``````` and then edited in the whole message but we dont see it
<oprypin> RX14, i know that for consistency it's much better but i dont care much, really
<RX14> well you can't please everyone
<oprypin> the real terrible idea is having 2 different syntaxes in the first place, as i've said before
<RX14> well using {} for multiline when the rest of the language uses do/end is ugly
<RX14> and using do/end on one line is ugly
<RX14> what is there to do?
<oprypin> we've been through this
<FromGitter> <Fanna1119> sorry
<RX14> we'd settle on do/end and {} would be removed and single-line blocks would be ugly forever
<RX14> i am 90% sure that's what would happen
<RX14> we have been through this
<RX14> and i'm sure you realise theres not much we can d
<RX14> o
<FromGitter> <georgeu2000> I have a question: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6dc78b59d55b823e31703]
<oprypin> meh just make &. syntax more powerful and remove {}
<FromGitter> <georgeu2000> Does this happen because `[] of Int32` is a pointer to a single array?
<FromGitter> <georgeu2000> So each array within ary is the same array?
<oprypin> yes
<FromGitter> <georgeu2000> Thanks.
<RX14> oprypin, actually thats not a *terrible* idea
<FromGitter> <oprypin> also note ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6dccf1081499f1f1c3a9e]
<RX14> oprypin, if we could make some good syntax that would be fun to explore
<oprypin> `ary = Array.new(20) { [] of Int32 }` gives the expected behavior
<FromGitter> <georgeu2000> I tried that too. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6dd6bbc464729741f1836]
<FromGitter> <georgeu2000> Oh, I see. It's different.
<FromGitter> <georgeu2000> Let me try.
<FromGitter> <georgeu2000> I am wondering about this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59b6ddc2c101bc4e3ab44d4d]
<FromGitter> <georgeu2000> Oh, I see. It works.
<FromGitter> <georgeu2000> Thanks.
<oprypin> `Array.new( 0, Int32 )` is `[] of Int32.class`
<oprypin> array of types
<FromGitter> <georgeu2000> Oh, I see.
<FromGitter> <georgeu2000> I see we need the block to initalize.
<oprypin> the block version and the argument version are sometimes interchangeable but the difference is that the block version runs that code every time and argument runs that code once
<FromGitter> <georgeu2000> Got it. Thanks.
<oprypin> `Array.new(6, 0)` and `Array.new(6) { 0 }` are interchangeable because Int32 is a wholly copyable value type
<FromGitter> <georgeu2000> I see.
<FromGitter> <georgeu2000> Thanks so much for your help.
<FromGitter> <georgeu2000> BTW, I am thinking about writing a Ruby -> Crystal transpiler. Do you think that would be useful?
<oprypin> about as useful as a Ruby -> C transpiler
<oprypin> also about as difficult and about as verbose resulting code
fnux has joined #crystal-lang
<oprypin> https://github.com/crystal-lang/crystal/pull/4946 man it really sucks that the PR was merged without me seeing it
<fnux> Hi there ! I'm trying crystal but I'm not even able to use the compiler..
<fnux> Error in test.cr:1: while requiring "prelude": can't find file 'prelude' relative to '/tmp'
<fnux> for /tmp/test.cr.
<fnux> I installed crystal with the official repo for redhat/centos. How crystal is supposed to load this 'prelude' thing ?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ShalokShalom> georgeu2000: i also thought about it already
<ShalokShalom> i think it would be a great benefit for both communitys
<ShalokShalom> Maybe think about Rails compability
<FromGitter> <georgeu2000> Yes, I think it would be awesome too.
<FromGitter> <georgeu2000> I searched and did not find any that had been started.
<FromGitter> <straight-shoota> @fnux what does `crystal env` give you?
<FromGitter> <straight-shoota> and does file `#{CRYSTAL_PATH}/prelude.cr` exist?
<oprypin> georgeu2000, you have to have a lot of experience with the language to do it, but people who have the experience don't see any point in the project
<FromGitter> <georgeu2000> Well, I'll have to get a lot of experience first.
<fnux> humm, crystal_path is empty
<fnux> that's probably the reason
<fnux> actually, what's this 'official' crystal package putting everything in /opt ?
<FromGitter> <straight-shoota> @fnux it's not an environment variable but printed when you run `crystal env`
claudiuinberlin has joined #crystal-lang
<fnux> yep, and it's empty ;)
<fnux> what's the difference between bin/crystal and bin/embedded/crystal ?
<fnux> ehu embedded/bin/crystal
<FromGitter> <straight-shoota> try to set env variable CRYSTAL_PATH to the src directory of your crystal installation, probably something like `/opt/crystal/src`
<fnux> bin/crystal properly set CRYSTAL_PATH but embedded/bin/crystal doesn't
<FromGitter> <straight-shoota> yes. `bin/crystal` just a wrapper around `embedded/bin/crystal` which sets these paths
<FromGitter> <straight-shoota> it's actually just a shell script, you can just take a look at it
Guest58799 is now known as baweaver
baweaver has quit [Changing host]
baweaver has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v51mY
<crystal-gh> crystal/master 6e576d8 Ary Borenszweig: Crystal::Hasher: change incorrect "*=" to "="
Rinkana has quit [Ping timeout: 260 seconds]
<FromGitter> <jwaldrip> why doesnt `Value` implement `#same?`
<FromGitter> <jwaldrip> it makes specs that use `should be(other)` break when referencing value.
<oprypin> jwaldrip, good to have it for consistency, but are you aware that it would always return false?
<FromGitter> <jwaldrip> Thats fine. Just as long as it doesnt create compile time errors
danzilio_ has joined #crystal-lang
<oprypin> make a PR, i'd support it
<FromGitter> <jwaldrip> is that because `==` always returns false?
<oprypin> jwaldrip, no
<oprypin> maybe add it to Object not to Value
twisterghost_ has joined #crystal-lang
aemadrid_ has joined #crystal-lang
<FromGitter> <jwaldrip> And just return false?
<oprypin> yeah
rohitpaulk has joined #crystal-lang
<oprypin> and remove this abomination while you're at it https://crystal-lang.org/api/0.23.0/Reference.html#same%3F%28other%3ANil%29-instance-method
hmans_ has joined #crystal-lang
manveru_ has joined #crystal-lang
<travis-ci> crystal-lang/crystal#6e576d8 (master - Crystal::Hasher: change incorrect "*=" to "="): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/274326633
SuperChickeNES has joined #crystal-lang
Liothen- has joined #crystal-lang
omninonsense has joined #crystal-lang
saadq_ has joined #crystal-lang
buggs has quit [*.net *.split]
saadq has quit [*.net *.split]
hmans has quit [*.net *.split]
[spoiler] has quit [*.net *.split]
twisterghost has quit [*.net *.split]
ChickeNES has quit [*.net *.split]
manveru has quit [*.net *.split]
danzilio has quit [*.net *.split]
aemadrid has quit [*.net *.split]
Liothen has quit [*.net *.split]
Liothen- is now known as Liothen
aemadrid_ is now known as aemadrid
hmans_ is now known as hmans
twisterghost_ is now known as twisterghost
<FromGitter> <jwaldrip> got it.
danzilio_ is now known as danzilio
<FromGitter> <jwaldrip> So why dont all objects have an object id?
manveru_ is now known as manveru
<FromGitter> <jwaldrip> Doesnt make sense why that method wouldnt be on Object, and only on reference
<oprypin> sure it does make sense
<oprypin> would you be OK with an object's id changing any time you pass it to a function or assign to it or anything?
<oprypin> or do ou suggest to store that object it together with every value (so UInt8 would take 8+64 bits)
<oprypin> ...object *id* together...
<oprypin> it's just not technologically viable or useful to have the object id for value types
<FromGitter> <jwaldrip> I would expect values object_id to change always
<FromGitter> <jwaldrip> because it is an object
<FromGitter> <jwaldrip> and by its definition, its copied when its passed
<FromGitter> <jwaldrip> but because it IS and object, I expect it to have an ID
<FromGitter> <jwaldrip> regardless if it changes everytime
<RX14> but the ID means nothing
<RX14> so why not just not have it
<FromGitter> <jwaldrip> because things that check object id, or use it in expectations fail
<RX14> it means you need to think about value types
<RX14> well its doing it's job then:
<RX14> it's making you think about value types
<FromGitter> <jwaldrip> so then expectations have to be refactored
<RX14> which?
<RX14> are you talking about the be expectation
<RX14> oh yes, you are
<FromGitter> <jwaldrip> Yes
<RX14> it's correct that be doesn't work for value types
<RX14> use eq like you should do
<RX14> a value type cannot "be" the same as another value type
buggs has joined #crystal-lang
<RX14> because as soon as you pass it into the function to compare if they're the exactly same instance
<RX14> they get copied
<RX14> and are not the same instance any more
<RX14> the concept of "the same instance from the same .new" simply does not exist for value types
<RX14> therefore it errors at compile time
<RX14> and therefore the behaviour is correct
<RX14> use eq
<FromGitter> <jwaldrip> sure, sucky experience when I union a value with a reference
<RX14> use eq
<FromGitter> <jwaldrip> k
<RX14> be expectation should be used very very rarely
<RX14> if at all
<RX14> it's probably more confusing than useful at this point
<RX14> but we'll probably keep it anyway
<FromGitter> <jwaldrip> IF I run be on a value... it should not fail compile, just fail the exception
<RX14> i disagree
<FromGitter> <jwaldrip> ive added #same? to Object
<RX14> dont monkeypatch
<FromGitter> <jwaldrip> where it returns false
<FromGitter> <jwaldrip> im not "monkey" patching.
<FromGitter> <jwaldrip> im changing the core type
<RX14> that's monkey patching to me
<FromGitter> <jwaldrip> "monkey" patching is after the fact
<FromGitter> <jwaldrip> and Value#==?
<FromGitter> <jwaldrip> what would you call that?
<RX14> you're changing the stdlib outside the stdlib, is that not what crystal people and ruby people generally refer to as monkey patching?
<FromGitter> <bew> @jwaldrip I'd say "content equality"
<FromGitter> <jwaldrip> I am defining Object#same? within "src/object"
<FromGitter> <jwaldrip> which is not outside the stdlib
<FromGitter> <jwaldrip> This is in crystal... not in my own project
<oprypin> ok so you're making your own programming language with one project?
<FromGitter> <jwaldrip> ... let me clarify... I am submitting a PR to crystal, adding `Object#same?`
<FromGitter> <jwaldrip> to make it work with expectations and behave like `Reference#same?`
<oprypin> after considering RX14's arguments i'm not so sure what's better
<FromGitter> <jwaldrip> to make `Value#same?`work with expectations and behave like `Reference#same?`
<RX14> my argument is that the very notion of "the same object" doesn't exist for value types and therefore the method shouldn't exist
<RX14> not aure what the rest of the core team thinks though
<FromGitter> <jwaldrip> So then the same argument would advocate for `#==
<FromGitter> <jwaldrip> to not exist
<FromGitter> <bew> Not part of the core team, but I agree with RX14 :)
<oprypin> jwaldrip, you don't understand `==`
<RX14> @jwaldrip uhh why?
<RX14> == is defined by the user
<RX14> to mean semantic equality
<FromGitter> <jwaldrip> I do understand `==`. If I didn't I wouldnt be a developer.
<FromGitter> <jwaldrip> And I get that as well.
<RX14> just how 1_u64 == 1_f64
<RX14> they're not even the same type
<RX14> let alone the same instance
<RX14> yet they are equal
<FromGitter> <jwaldrip> I understand that
<RX14> they're fundamentally different concepts and should be treted differently
<FromGitter> <jwaldrip> If I think about the ruby argument of "reads like english" then the following should return false, and not a compile error. "1.same? 1"
<oprypin> sure, it makes sense
<RX14> i've never used same?
<FromGitter> <jwaldrip> as with the expecation "1.should be 1" should throw a spec expection, NOT a compile error.
<RX14> has ayone else?
<FromGitter> <jwaldrip> exception*
<FromGitter> <jwaldrip> it IS used, my argument that even though you dont like be it is used. And this leads to less expeience developers scratching their head when using be with Value types.
<FromGitter> <jwaldrip> I obviously had to dig into crystal to understand why
<oprypin> RX14, heh I used it in a project to replace .should be and company
<RX14> lol
<RX14> apart from stdlib refactorings
<FromGitter> <jwaldrip> Point being... I would want a better message in the expectation, and expect .same? to work
<RX14> @jwaldrip i'd argue that maybe be should be modified
<oprypin> jwaldrip, do you think developers will be less confused when you do `a = 5; a.same?(a) - false`
<RX14> to return false if its a value type
<oprypin> jwaldrip, but in a much more concealed way than that
<FromGitter> <jwaldrip> so I could see that... refactor `be` rather than add `same?`
<FromGitter> <jwaldrip> @oprypin as long as `same?` is documented
<FromGitter> <jwaldrip> same should mean is the same in memory, same as in if I change it here, it is changed everywhere
<oprypin> i like that
<FromGitter> <jwaldrip> which part?
<oprypin> > same should mean is the same in memory, same as in if I change it here, it is changed everywhere
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <jwaldrip> So I think `#same?` could still be added to `Object` as an abstract method and then added to `Value`
<FromGitter> <jwaldrip> similar to `==`
<FromGitter> <jwaldrip> I know how `==` works
<FromGitter> <jwaldrip> I am just talking about the method of implementation
rohitpaulk has quit [Ping timeout: 240 seconds]
bmcginty has quit [Ping timeout: 240 seconds]
bmcginty has joined #crystal-lang
bmcginty has quit [Ping timeout: 240 seconds]
alex`` has quit [Ping timeout: 240 seconds]
<FromGitter> <opensas> > **<oprypin>** mm finally formulated my version of semantic rule - use do...end if the block has side effects, use { } if the block's result is used ⏎ yeap, having no ruby background, I feel more comfortable with this version of semantic rule, when I just to calculate some value (sort of functional style) I use {}, when I modify any external variable (sort of procedural style) I use do...end, makes more
<FromGitter> ... sense to me....
<crystal-gh> [crystal] RX14 opened pull request #4955: Remove markdown, use markd shard in compiler (master...refactor-markdown) https://git.io/v510l
danielpclark has joined #crystal-lang
<oprypin> RX14, your commits on github seem to have a timestamp in the future. gotta check that :o
<FromGitter> <matrixbot> `@Renich:matrix.org` hey guys, I need an opinion. I just applied this huge patch; taken from the git repo, and applied it in gentoo. It builds but, should I use it like this? https://clbin.com/rrbd2?hl
<FromGitter> <matrixbot> `@Renich:matrix.org` The patch is huge
<FromGitter> <matrixbot> `@Renich:matrix.org` context: gentoo is using LLVM 5 now. This patch makes stuff actually build. Taken from: https://github.com/crystal-lang/crystal/commit/3d48a9628d57cea739f30583fa6092aa9dd90be3
wes[phi] has joined #crystal-lang
<FromGitter> <matrixbot> `@Renich:matrix.org` and applied to tag 0.23.1
wes[phi] has quit [Ping timeout: 240 seconds]