ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
<FromGitter> <Sija> @RX14 u here?
<RX14> yeah
<crystal-gh> [crystal] mohd-akram opened pull request #5970: Improve static compilation support (master...static-compile) https://git.io/vpqGh
<RX14> not any more
<RX14> it's 1am
<FromGitter> <girng> lmao
<RX14> b y e
<FromGitter> <Sija> yeah, it’s night mode for sure
<FromGitter> <j8r> @asterite thanks, my bad I need to put some other conditions
<FromGitter> <Sija> @RX14 I was hoping you’d explain me what do u mean with your comment regarding benchmarking this seemingly insignificant change
<FromGitter> <girng> i love CRYSTAL
<FromGitter> <BrucePerens> @bew fixed, thanks!
<FromGitter> <bew> @asterite I'm trying to understand why #5752 happens, but can't seems to find how private things works, do you remember sth about it?
<DeBot> https://github.com/crystal-lang/crystal/issues/5752 (Private alias in toplevel are not private)
<FromGitter> <BrucePerens> @RX14 If I create a string from a literal, does the data memory start from the readonly text of the ELF, and if I modify the string do I then get copy-on-write? This is an implementation detail that language users would not see.
<FromGitter> <bew> strings are immutable, so as soon as you do a string modification you get a new (allocated) string
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
duane has joined #crystal-lang
<FromGitter> <BrucePerens> @bew OK, fixed in the document. Thanks!
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
<FromGitter> <girng> is there something similar to PHP's `preg_replace($pattern, $replacement, $string);`, but with a limiter?
<FromGitter> <asterite> bew because aliases are expanded to whatever the aliased type is, eagerly, so the privateness is lost. Probably super hard to fix. I'd really like to remove private types from the language, they only make things complex
<FromGitter> <girng> basically, i want to limit the string to have 10 newlines, if anymore, they need to be replaced
<FromGitter> <asterite> Use gsub with a block and keep a counter
<FromGitter> <girng> ok
<FromGitter> <girng> let me try
<FromGitter> <girng> plz dont give answer
<FromGitter> <girng> i want to see if i can do this
<FromGitter> <asterite> Sure. I actually searched how to do that in Ruby :-P
<FromGitter> <girng> OMG...
<FromGitter> <girng> ok this is all i got https://play.crystal-lang.org/#/r/3wnf
<FromGitter> <girng> i give up, i don't UNDERSTAND why it's not working
<FromGitter> <girng> `Returns a String where all occurrences of the given string are replaced with the block's value.`
<FromGitter> <ezrast> What is the block's value if counter <= 10?
<FromGitter> <girng> im using an if statement, if counter is greater than 10, return "" (which is the returned for the block)
<FromGitter> <girng> which is a BLANK string...
<FromGitter> <girng> which is the blocks value a BLANK string
<FromGitter> <girng> return value*
<FromGitter> <ezrast> what result are you expecting?
<FromGitter> <girng> only to replace the `\n` atfter the counter is greater than 10
<FromGitter> <ezrast> so the block works properly when the counter is greater than 10, yes? It's the other case that's the problem.
<FromGitter> <girng> yes, if greater than 10, return "" that replaces the rest of the \n's
<FromGitter> <girng> `the given string are replaced with *the block's value*.`
<FromGitter> <ezrast> I'm not asking about when it's greater than 10
<FromGitter> <ezrast> do you know what value an if statement with a falsey condition evaluates to?
<FromGitter> <girng> it evalutes tof alse, which shouldn't return anything
<FromGitter> <girng> so iuno why its replacing all the \n's
<FromGitter> <girng> if it's not returning anything, `block` doesn't have a value to replace anything
<FromGitter> <ezrast> wrong on both counts
<FromGitter> <girng> ok
<FromGitter> <girng> well, that's what i got out of it from reading the description
<FromGitter> <girng> it quite literally says that so
<FromGitter> <girng> where all occurrences of the given *string are replaced with the block's value*.
<FromGitter> <ezrast> an if statement that doesn't execute evaluates to nil: https://carc.in/#/r/3wnl
<FromGitter> <ezrast> and nil is a value that can be returned
<FromGitter> <girng> ok that makes that sense
<FromGitter> <girng> however, why is nil replacing my string?
<FromGitter> <ezrast> every single \n gets replaced by the return value of your block. Knowing what you now know, what values is it possible for your block to return?
<FromGitter> <girng> so, all of them are replaced with a nil value, until greater than 10, of which are replaced by ""?
<FromGitter> <ezrast> yep
<FromGitter> <girng> but when i do puts or p
<FromGitter> <girng> it doesn't show NIL
That_Guy_Anon1 has joined #crystal-lang
<FromGitter> <girng> im so confused...
<FromGitter> <girng> but your EXAMPLE, it shows NIL
<FromGitter> <girng> ..............
<FromGitter> <ezrast> gsub runs `.to_s` on the thing to make it a string
<FromGitter> <girng> oh, your using `pp`?
<FromGitter> <girng> let me try that
<FromGitter> <girng> https://play.crystal-lang.org/#/r/3wnn still doesn't show `nil`
<FromGitter> <girng> i give up
<FromGitter> <ezrast> gsub can't just nest a random object inside a string; it has to convert the object into a string
<FromGitter> <ezrast> > > pp nil
<FromGitter> <ezrast> oops
That_Guy_Anon has quit [Ping timeout: 255 seconds]
<FromGitter> <ezrast> consider https://carc.in/#/r/3wno
That_Guy_Anon1 has quit [Remote host closed the connection]
<FromGitter> <girng> so when it gets converted to a string the `nil` isr eplaced, even when using `p`
<FromGitter> <girng> and @oprypin said `p` is a debugging tool
<FromGitter> <girng> why remove the nil's then
<FromGitter> <girng> not fair at ALL
<FromGitter> <ezrast> p isn't removing the nils
<FromGitter> <ezrast> gsub is converting them to their string representation
<FromGitter> <ezrast> it has to
That_Guy_Anon1 has joined #crystal-lang
<FromGitter> <ezrast> because gsub returns a string
<FromGitter> <girng> but p is a debugging tool, i should see them just like how the new lines get converted to \n
<FromGitter> <girng> because in my example, to me, it looks like my gsub is replacing all of them with "", which isn't true. it's actually replying some with nils
<FromGitter> <girng> but those are not printed or shown..
<FromGitter> <girng> even when using `p`
<FromGitter> <ezrast> no, it's replacing all of them with ""
<FromGitter> <girng> wat, it hought they were replaced with nil, then the rest are were the blank string ("")
<FromGitter> <ezrast> they're replaced with `nil.to_s`
<FromGitter> <girng> which translates to = ""?
<FromGitter> <ezrast> yes
<FromGitter> <girng> ic
<FromGitter> <girng> ok so the only way for gsub to work
<FromGitter> <girng> is i need to pass in the current string it's replacing through the block
<FromGitter> <girng> so i can return that string instead of nil ("")
<FromGitter> <girng> correct?
<FromGitter> <girng> how i can make it so the blocks value doesn't replace ANYTHING
<FromGitter> <ezrast> you already know what value it's replacing, "\n"
<FromGitter> <girng> yes but i need to return the string not a value if i want to keep it
<FromGitter> <girng> im only trying to convert the first 10 \n's
<FromGitter> <girng> wait, no
<FromGitter> <girng> i mean convert the \n's after there is 10
<FromGitter> <girng> why i use a counter
<FromGitter> <ezrast> replacing a "\n" with a "\n" is the same as not replacing it
<FromGitter> <girng> i got it ??
<FromGitter> <ezrast> there you go
<FromGitter> <girng> Ok i think i know what went wrong here
<FromGitter> <girng> i thought i was enumerating through every WORD. of which i am not. i'm only enumerating through the \n's lol
<FromGitter> <girng> sorry about that, thanks for your cordiality through this
rain1 has joined #crystal-lang
<FromGitter> <girng> i also though, it would automatically return "\n" and replace the nils . which is not true (my bad). that's why i tried to just do it with a 1 liner
<FromGitter> <girng> i also thought*
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
duane has quit [Ping timeout: 248 seconds]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
binBASH has quit [Ping timeout: 276 seconds]
binBASH has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
qard has joined #crystal-lang
qard has quit [Quit: qard]
<FromGitter> <girng> @asterite ok finally got it in a two liner: https://play.crystal-lang.org/#/r/3wp6 :)
<FromGitter> <girng> ty for help asterite n ezrast
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
<FromGitter> <girng> https://play.crystal-lang.org/#/r/3wpc/edit ⏎ ⏎ is this a bad way to check for the amount of linebreaks? split "makes an array" not sure if that is fine, opyrprin prob doesn't approve of this :P
<FromGitter> <Givralix> there's a count method in String @girng https://crystal-lang.org/api/0.24.2/String.html#count%28other%3AChar%29-instance-method
<FromGitter> <girng> im not sure if that will work https://play.crystal-lang.org/#/r/3wph
<FromGitter> <girng> looks like it counts the characters
<FromGitter> <Givralix> oh :/
<FromGitter> <girng> but i mean i can use the split("\n").size, but just curious if it's liek bad or just fine
<FromGitter> <girng> i should be ok right. the string im parsing will be less than 1500 in bytes
<FromGitter> <bararchy> Well, if you only want to count how many "\n" you have then its not really optimal to split, as you're creating a new array
<FromGitter> <girng> yeah, which is allocated on the heap right
<FromGitter> <girng> and puts pressure on GC?
<FromGitter> <bararchy> I'll do something like ` counter = 0 ; string.each_char { |c| counter +=1 if c == "\n" } `
<FromGitter> <girng> hmm same issue as before, it's a character
<FromGitter> <girng> \n is a word i guess
<FromGitter> <bararchy> '\n'
<FromGitter> <bararchy> I think it should work
<FromGitter> <girng> all false
<FromGitter> <girng> is there a `each_word` method?
<FromGitter> <bararchy> @girng https://play.crystal-lang.org/#/r/3wpn
<FromGitter> <bararchy> Working
<FromGitter> <girng> wtf
<FromGitter> <girng> why doens't mine work lol
<FromGitter> <bararchy> Because you use "\n" and not '\n'
<FromGitter> <girng> but it's looping through each character
<FromGitter> <girng> how does it match \n???
<FromGitter> <girng> WTFF
<FromGitter> <girng> that's two characters
<FromGitter> <bararchy> @girng \n is what is called 'control character' its not really 2 Char , its a single on called LF
<FromGitter> <bararchy> Its just visually looks like 2 Char
<FromGitter> <girng> interesting
<FromGitter> <bararchy> @girng also \s = space , \t = Tab
<FromGitter> <girng> so the each_char is better because it basically just increments a counter instead of making a whole new array and filling it
<FromGitter> <bararchy> Yeha
<FromGitter> <bararchy> And will work better for big Strings too
<FromGitter> <girng> i could prob create something cool where i can just do "".mycustommethodnamehere or something?
<FromGitter> <girng> then just call that on the string, and have it return counter orsomething
<FromGitter> <bararchy> @girng I think string.count will also work if you use '\n'
<FromGitter> <bararchy> As a Char
<FromGitter> <girng> little tiny library if you will
<FromGitter> <bararchy> Try it
<FromGitter> <girng> oh it does work
<FromGitter> <girng> @Givralix sorry about that, you were right
<FromGitter> <girng> `\n` for control characters im guessing, and "" for full / real strings
<FromGitter> <girng> \`\` i mean
<FromGitter> <girng> '' i mean
<FromGitter> <girng> wow, fail :D
PickleRick has joined #crystal-lang
PickleRick has left #crystal-lang [#crystal-lang]
flaviodesousa has joined #crystal-lang
alex`` has joined #crystal-lang
Ven`` has joined #crystal-lang
baweaver is now known as lemur
lemur is now known as baweaver
alex`` has quit [Ping timeout: 240 seconds]
That_Guy_Anon1 is now known as That_Guy_Anon
Ven` has joined #crystal-lang
Ven`` has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> morning
That_Guy_Anon has quit [Ping timeout: 276 seconds]
<FromGitter> <girng> morning @sdogruyol how are u doing
<FromGitter> <sdogruyol> fine, and you girng
<FromGitter> <girng> very good
<FromGitter> <girng> learning more and more crystal everyday
<FromGitter> <girng> slow and steady wins the race
That_Guy_Anon has joined #crystal-lang
<FromGitter> <sdogruyol> yeah, seems like you're having fun 👍
<FromGitter> <girng> i'm breaking the conditioning of crappy core values nodejs indoctrinated me in. im sick of it
<FromGitter> <sdogruyol> like what?
<FromGitter> <straight-shoota> morning =)
<FromGitter> <girng> types
<FromGitter> <girng> there are soo many TYPES and they are all super important
<FromGitter> <sdogruyol> morning @straight-shoota
<FromGitter> <girng> to know which type does what. in nodejs it seems like i never knew anything besides a string or number
<FromGitter> <sdogruyol> I feel you...I've done some Nodejs back in 0.8 - 0.10 days
<FromGitter> <sptorin_twitter> How I can get all matches from regexp, like flag /regexp/g? For example need get all numbers from line: `"1q2w".match(/\d+/).not_nil!.to_a` - this get only first match
<FromGitter> <sdogruyol> glad that I escaped callback hell
<FromGitter> <girng> Agree!
Jenz has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 240 seconds]
Jenz has left #crystal-lang [#crystal-lang]
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
<FromGitter> <sdogruyol> wtf...the new reddit design is so ugly..
<FromGitter> <girng> ikr
<FromGitter> <girng> dat popup when u click on a thread rofl
<FromGitter> <sdogruyol> thanks god there's a rollback to old design
<FromGitter> <girng> i only use reddit cuz programmingcirclejerk and crystal lang sub
<FromGitter> <sdogruyol> same, just some subreddits
<FromGitter> <girng> yeah thank goodness they let u opt out of it lol
<FromGitter> <girng> i would be pretty mad...
<FromGitter> <girng> well, i just wouldn't visit the site anymore. more time in sublime for crystal :D
<FromGitter> <girng> turn negative into a positive, right!?
<FromGitter> <sdogruyol> lol
rohitpaulk has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
<oprypin> I don't see any new design
<oprypin> oh geez
<oprypin> http://i.reddit.com is always there for you
<FromGitter> <girng> tfw their 2010 mobile looks better than their beta one in 2018 :rofl:
<crystal-gh> [crystal] oprypin closed pull request #4906: Remove Crystal::System, do system-specific methods by reopening (master...no-crystal-system) https://git.io/v5le3
<crystal-gh> [crystal] oprypin closed pull request #5003: Change Errno into a hierarchy of OSError subclasses (master...oserror) https://git.io/v5bAY
<crystal-gh> [crystal] straight-shoota opened pull request #5972: Fix macro interpreter Number type of arithmetic expressions (master...jm/fix/5971) https://git.io/vpq1Q
<FromGitter> <drum445> Yeah JS is pretty frustrating
<FromGitter> <drum445> It's bad enough on the client let alone on the server lol
<FromGitter> <girng> i'm glad i made the switch, i feel way better about myself
<FromGitter> <girng> i do want to buy a crystal hoodie however
<FromGitter> <drum445> If i have a models folder and one inherits from the other, unless the parent class has a name which appears first in the list it will not be able to be referenced
<FromGitter> <drum445> For example, if asset_repo is inheriting from base_repo it won't be able to find it when the models directory is imported into the main file
<oprypin> you're doing it wrong
<oprypin> if something requires something, you write `require "./something"`
<oprypin> and stop with the stupid `*` requires
<FromGitter> <drum445> so in my asset_repo file I would require my base_repo file yes?
<oprypin> yes
<FromGitter> <drum445> cheers,
<livcd> I wish JS would just die :P
<FromGitter> <girng> i want the black hoodie from crystal's twitter iuno wher eto buy it though
alex`` has joined #crystal-lang
<oprypin> girng, in case it wasnt clear, it's not on sale
<FromGitter> <girng> but they were in boxes, and wrapped in plastic bags
<FromGitter> <girng> looks like crystal devs doing a heist with em, be careful!
<oprypin> girng, they were given to participants of a meetup
<FromGitter> <girng> yah understandable
<FromGitter> <girng> @oprypin i was curious since you're online i might as well ask. but since im about finished with my master game server (which sends data as json and uses `to_json`) alot. is there an alternative to that, that is faster for the regular game instance server code? it'll be running on a 15hz~ tickrate. with preferable 20, 50, or 100 users on an instance. ⏎ ⏎ i was reading about msgpack, but godot
<FromGitter> ... unfortunately doesn't have a module.
<oprypin> msgpack, protobuf
<oprypin> no module, too bad
lvmbdv has quit [Ping timeout: 256 seconds]
<FromGitter> <girng> would it be insane to just send a string and separate movement code by a delimiter?
<oprypin> yes
lvmbdv has joined #crystal-lang
<FromGitter> <girng> hmm, maybe i can pay someone to add a msgpakc module to godot. since crystal has one. or i can try to do it myself. i already know how to compile godot from source
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oprypin> girng, could be easier to make crystal understand what godot sends in http://docs.godotengine.org/en/3.0/classes/class_packetpeer.html
<oprypin> this is their own custom msgpack
<oprypin> sounds like a fun proejct
<FromGitter> <girng> yeah thing is i rrlly want to finish the game server stuff. but i know i can't be using to_json on a 15hz tick rate server can't be good
<FromGitter> <girng> maybe it is iuno
<oprypin> girng, this is premature optimization
<oprypin> you're just guessing things
<oprypin> it is indeed a good idea to have something working first
<FromGitter> <drum445> What on earth have I done wrong here lol ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ad9c8e762316e0505def794]
<FromGitter> <girng> i already have it wirrten in nodejs im converting. dropping item, tick-rate for movement data, pvp, trading, looting an item, in-game chat, moving items in inventory, equipping items, updating when another player equips an item. only part is the `to_json` gonna be called on all these functions. plus the 15hz tick rate going with 10, 50, or 100 players. that is a LOT of `to_json` calls ⏎ ⏎ should i just
<FromGitter> ... finish converting it over, and use it like how my master game server is structured? then just benchmark it later?
<oprypin> yes
<oprypin> switching to a different json-like format will be easy
<FromGitter> <girng> ok
Ven`` has joined #crystal-lang
<FromGitter> <girng> @oprypin btw thx for putting up with me this far (and everyone else really), i appreciate it =]
alex`` has quit [Ping timeout: 264 seconds]
<FromGitter> <ansarizafar> Whats ids the current status of Crystal. Is it production ready?
<FromGitter> <asterite> No, it's always "use it at your own risk"
<wuehlmaus> ``make docs'' still does not work for me on Apple with crystal git. it used to work.
<wuehlmaus> some openssl issues
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
That_Guy_Anon has joined #crystal-lang
Ven`` has joined #crystal-lang
shalmezad has joined #crystal-lang
duane has joined #crystal-lang
<oprypin> wuehlmaus, maybe post a bug and reference #5676
<DeBot> https://github.com/crystal-lang/crystal/pull/5676 (Fixed OpenSSL bindings to recognize LibreSSL)
<FromGitter> <drosehn> I have used crystal to write a few small programs which are being used "in production", but I wouldn't use crystal for some large project that I was just starting on.
<FromGitter> <drum445> The release of 1.0 would make it production ready right?
<oprypin> ...
<FromGitter> <drum445> ?
<FromGitter> <fridgerator> I think 1.0 would just mean much fewer breaking changes
<FromGitter> <drosehn> Well, at that point the language would be less likely to have major changes. And if there are major changes, it's more likely that they will include some way to automate the changes that you'd need to make.
<FromGitter> <drosehn> ... that crystal-users would need to make to their own programs, that is.
aarongodin has quit []
aarongodin has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
hightower3 has joined #crystal-lang
greengriminal has joined #crystal-lang
hightower2 has quit [Ping timeout: 256 seconds]
<FromGitter> <sdogruyol> @ansarizafar 1.0 means production-ready for all, we've some production users though
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vpmYU
<crystal-gh> crystal/master ef528a5 Julien Reichardt: Add Gitter badge (#5967)
<FromGitter> <girng> i go off by what sdo has said
<FromGitter> <j8r> By the way production ready is a biased concept
<FromGitter> <girng> he uses it in production for HOTEL services...
<FromGitter> <girng> for months..
<FromGitter> <sdogruyol> it's not hotel services..it's payment processing at scale girng
<FromGitter> <girng> i thought i read hotel services
<FromGitter> <j8r> Breaking changes are suprisely easy to handle, the compiler is quite nice to explain what/how to change
<FromGitter> <girng> i misread "Protel" as Hotel
<FromGitter> <girng> my bad, apologies....
<FromGitter> <girng> i always thought it was a hotel service lol gjuss i am wrong
<FromGitter> <j8r> For production the main point is Tests, load and HA. - whatever you use, if you app handle this, and works for 1 day, you are good
That_Guy_Anon has joined #crystal-lang
jetpack_joe has quit []
jetpack_joe has joined #crystal-lang
<FromGitter> <asterite> So... I'm back on track, but when trying to compile specs I get an error: error executing command: echo "#include <openssl/opensslv.h>
<FromGitter> <asterite> LIBRESSL_VERSION = {{ system("echo \"#include <openssl/opensslv.h>\nLIBRESSL_VERSION_NUMBER\" | " +
<FromGitter> <asterite> :-(
<FromGitter> <asterite> what the heck is that? :-P
<FromGitter> <bararchy> Do you have openssl-dev package?
<FromGitter> <asterite> No, and I don't need to have it, I'm on a Mac, and I think Mac doesn't use openssl
<wuehlmaus> that's what you get, too when you do ``make docs''
<FromGitter> <asterite> Come on, it's invoking `cc` every time we compile something...?
<FromGitter> <asterite> Why do we need libressl anyway? openssl is bad?
<travis-ci> crystal-lang/crystal#ef528a5 (master - Add Gitter badge (#5967)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/369148180
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <j8r> yes. Joke apart, LibreSSL has a more robust security development. Thank you the OpenBSD team :-D
<FromGitter> <asterite> Well, for now I'll just comment some stuff to continue working... but this is a bit messy, no one in mac-land should be able to work in the compiler right now
<FromGitter> <j8r> But the macOS CI pass...
<FromGitter> <j8r> If the specs require some libs, and you don't have them, this is normal to fail isn't it?
<FromGitter> <j8r> Maybe you have to use homebrew
<oprypin> asterite, just revert #5676 and let's move on
<DeBot> https://github.com/crystal-lang/crystal/pull/5676 (Fixed OpenSSL bindings to recognize LibreSSL)
<FromGitter> <asterite> It's passing "PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH""
<FromGitter> <asterite> all the time, when compiling
<FromGitter> <asterite> I don't want to pass that
<FromGitter> <asterite> I don't need that, because openssl on mac is useless, mac has its own crypto library (I think compatible with openssl)
<FromGitter> <bararchy> @asterite I think it needs it for specs , because specs does SSL checks
<FromGitter> <asterite> We could do that, or we could just put {%if !flag?(:darwin) %} around all that
<FromGitter> <yxhuvud> or check for lib availability
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
<FromGitter> <drum445> Has anybody used MongoDB with Crystal?
<FromGitter> <drum445> Everything was going well until I tried to apply sorting...
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> @asterite macos dev just sucks
<RX14> it's combination of two things
<RX14> openssl and libressl provide incompatible pkg-config versions so it's impossible to support openssl and libressl using just pkg-config version queries
<RX14> and then mac's openssl/libressl situation is just shit
<RX14> at the end of the day I just approved that libressl PR because it worked on my machine and I stopped caring
<FromGitter> <girng> gn c u in 5-6 hour need sleep
<crystal-gh> [crystal] LVMBDV opened pull request #5973: Fix/4676 libressl support (master...fix/4676-libressl-support) https://git.io/vpmBb
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <drum445> no stress with the order by in mongo, just sort the Array(BSON) on return
<crystal-gh> [crystal] asterite opened pull request #5974: Add `MetaVar#defualt_value` and `MetaVar#has_default_value?` (master...feature/macro-default-value) https://git.io/vpmEf
That_Guy_Anon has joined #crystal-lang
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<crystal-gh> [crystal] Willamin opened pull request #5975: Update loop (master...patch-2) https://git.io/vpm24
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vpm2R
<crystal-gh> crystal/master af2e23d Ata Kuyumcu: Fix OpenSSL binding C preprocesor hack failing on absence of headers (#5973)...
alex`` has joined #crystal-lang
baweaver is now known as baweaver_away
baweaver_away is now known as baweaver
<FromGitter> <Givralix> hi again
<FromGitter> <Givralix> is there any way to get an Array/Set/etc's T constant?
<RX14> depends what you mean
<RX14> typeof(array[0]) will work
<FromGitter> <Givralix> I need it at runtime but I figure I could just extend Array and do what I need in a function in there
<FromGitter> <Givralix> thanks!!
pbodev1 has joined #crystal-lang
duper_ is now known as duper
alex`` has quit [Ping timeout: 265 seconds]
<travis-ci> crystal-lang/crystal#af2e23d (master - Fix OpenSSL binding C preprocesor hack failing on absence of headers (#5973)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/369213998
<DeBot> https://github.com/crystal-lang/crystal/pull/5973 (Fix OpenSSL binding C preprocesor hack failing on absence of headers)
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> Nice to see you back @asterite :)
Nathanaelle has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 265 seconds]
Nathanaelle has quit [Ping timeout: 260 seconds]
<FromGitter> <asterite> :)
<FromGitter> <bew> You said several times in comments here and there that you wanted some changes for the language itself, did you already put all your ideas on paper (or in text for that matter) ? Or is it still some vague abstract ideas in your mind?
<FromGitter> <bew> 'cause I'd like to know what you have in mind (I'm sure I'm not alone in that case ^^)
<FromGitter> <asterite> I have some vague ideas, not sure how it's going to work. But it'll change the language quite a lot
<FromGitter> <asterite> Named tuples would disappear, splat arguments will just be one one type
<FromGitter> <asterite> No more class reopening (though we'd probably have extension methods)
<FromGitter> <asterite> No method redefinition
<FromGitter> <asterite> Mandatory types in method arguments and return types
<FromGitter> <asterite> and constants
<FromGitter> <asterite> Probably interfaces
<FromGitter> <bew> oh wow, looks almost like another language, at least in "how it works"
<FromGitter> <asterite> I think it's either that, or forever stick with possibly huge compile times
<FromGitter> <asterite> Or, mmm... never decreasing compile times
<FromGitter> <asterite> But people seem to be fine with the latter, so let's go with that option instead
<FromGitter> <asterite> (and I think that also includes a broken type system, not sure how it can be fixed without breaking changes)
<FromGitter> <bew> To me (but I don't know much here) it would be kinda possible to have re-usable pre-compilation of some shards for example (with a custom pre-compilation format) that could reduce compile time
<FromGitter> <bew> but sure, having a custom everything takes time
Nathanaelle has joined #crystal-lang
<FromGitter> <bew> or like, if some shard API is fully typed, (or partially?) the compiler could re-use a previous compilation of those methods
<FromGitter> <bew> some shard API *method
<FromGitter> <bararchy> @asterite I think the current features of the languge outwight the compile time issue
<FromGitter> <j8r> Why remove namedtuple? How we will be able to have immutable hashes? Tuple will also disapear?
<FromGitter> <bararchy> anyway, this won't happen I hope without a big discussion in the CoreDev team and the community as a whole.
<FromGitter> <asterite> because NamedTuple exists for double splat, and in that language I imagine double splat can't exist
<FromGitter> <bew> but the call flexibility we currently have would remain?
<FromGitter> <asterite> I don't think so
<FromGitter> <asterite> it will be more like other languages, like C#, which is pretty flexible
<FromGitter> <asterite> I mean, what's the current flexibility?
<FromGitter> <j8r> To sum up, what can be the future syntax for immutable hashes?
<FromGitter> <bararchy> ```{"foo": 1}.freeze```
<FromGitter> <bararchy> lol
<FromGitter> <asterite> The question is: why do you need immutable hashes?
<FromGitter> <asterite> And if you need them, they can just be a new data structure
<FromGitter> <j8r> I'm generating macros based on a named tuple actually
<FromGitter> <j8r> Symbol will be replaced by string - seems ok
<FromGitter> <asterite> You can use hash in macros, it's the same
<FromGitter> <asterite> Anyway, these are just ideas... I think the current language will remain like that
<FromGitter> <j8r> What's nice in NamedTuple in my case (a CLI entirely generated by a macro) is: Symbol can't have spaces, and `{test: "string} ` is more concise than `{"test" => "string"}`. ⏎ But if I've no longer NamedTuples, it will not be a big deal to change to Hashes and add a check for spaces
<oprypin> news flash
<FromGitter> <bew> by call flexibility, I mean positional & named args, can use named in call for any args, arguments forwarding, and basically the content of https://crystal-lang.org/docs/syntax_and_semantics/default_values_named_arguments_splats_tuples_and_overloading.html
<oprypin> >> {"a b c": 5}
<DeBot> oprypin: # => {"a b c": 5} - https://carc.in/#/r/3wse
<FromGitter> <bew> :D
<oprypin> >> :"and of course symbol"
<DeBot> oprypin: # => :"and of course symbol" - https://carc.in/#/r/3wsf
<FromGitter> <j8r> @oprypin I didn't know this, but there is no point of symbols so?
alex`` has quit [Ping timeout: 276 seconds]
<oprypin> well what do you think the point of symbols was, not having spaces?
<FromGitter> <asterite> bew: yes, argument forwarding is the only reason named tuple exists... but it makes APIs hard to use, because then you have to say "just look at the docs of this other function". And duplicating those methods just once isn't a big deal
<FromGitter> <j8r> Hum maybe
<FromGitter> <j8r> They can only be strings with no spaces, like arguments i guess?
<FromGitter> <j8r> but I m maybe wrong, can we have named arguments with spaces?
<FromGitter> <asterite> yes, we can
<FromGitter> <j8r> Hum yeah indeed this is linked to symbols
<FromGitter> <asterite> we can... it's a cute thing, probably not very useful... well, only to pass things like a hash, to avoid some memory allocation... but with that duplicate the amount of generated code :)
<FromGitter> <asterite> so... really, there's no good use case for named tuples other than forwarding... in fact, we created them exclusively for that, but everyone understood them wrong
<Yxhuvud> asterite: how impossible is it to unduplicate the code without cutting the feature?
<FromGitter> <asterite> so even if the language doesn't change, maybe it would be good to remove them
<oprypin> asterite, just fork it and hack away
<FromGitter> <asterite> To unduplicate code I think you need runtime reflection
<FromGitter> <asterite> oprypin :-)
<oprypin> i kinda don't get why you want to turn Crystal into C#
<FromGitter> <asterite> to have a language that can grow
<oprypin> c# can grow
<FromGitter> <asterite> yes, it's always growing
<oprypin> good
<FromGitter> <drum445> you lot like c#?
<FromGitter> <eliasjpr> I always had the impression of NameTuple to be more of a borrowed concept to support functional paradigm, and to quickly define an inmutable type with a nice easy to read syntax. I personally find the following to be elegant ⏎ ⏎ ```alias response = NameTuple(error: Bool, body: String)``` ⏎ ⏎ So my question is how would someone define a mutable type besides a struct and class with no accessors? Class
<FromGitter> <asterite> It's a really good language. But others are good too
<FromGitter> <asterite> eliasjpr: `record Response, error : Bool, body : String`
<FromGitter> <asterite> Just the same thing. Even less typing: `response.error` vs. `response[:error]`
<FromGitter> <asterite> So we could already remove NamedTuple and Symbol :-D
<FromGitter> <asterite> (which, like RX14 says, doesn't have much use cases, it's similar to String)
<oprypin> it's not hurting anyone
<RX14> oh yeah
<RX14> thats why we have symbols again
<RX14> for named tuple keys
<RX14> aand thats it :P
<oprypin> python has like 10 variations of structs and namedtuples that dont even have a performance advantage, and it's fine
<Yxhuvud> well, they are pretty nice for my parser generator as it is nice to have a convenient way to create nonterminals without mixing them up with strings :P
rohitpaulk has joined #crystal-lang
<FromGitter> <asterite> symbols are also used in the compiler's lexer, and they are kind of useful too
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <asterite> but of course they kill any future effort to have incremental/modular compilation, because the compiler has to know all symbols out there
<FromGitter> <asterite> maybe that's fine (and I stop musing about such things)
<FromGitter> <bew> modular compilation could still be possible with a custom pre-compilation stage, where you'd have all the symbols needed by a module, but not yet with a number associated with it
greengriminal has joined #crystal-lang
<FromGitter> <bew> Also, I was wondering, instead of assigning a number to a symbol, could we have symbols as String objects (read-only in ELF) and use the address of the String object to check if it's the same symbol or not?
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <asterite> That's a good idea
<FromGitter> <bew> cool, glad I got one :) which one?
<Yxhuvud> I think we need to get more people to deeply understand the issues and the code involved here, as (at least for me), problems have a tendency of going away when multiple people approach the problem from different starting points. Then there are problems that don't go away (like compilation times of c++), but many do, at least for me
<Yxhuvud> I wish I had more time :/
<FromGitter> <j8r> Crystal will never be perfect, but the community is working hard on it - this is what Crystal is awesome
<FromGitter> <asterite> I'd like to implement some form of meta attributes
<FromGitter> <asterite> I saw that bcardiff proposed, and C# also has this, the ability to specify a same attribute multiple times... anyone knows what's that used for?
<FromGitter> <asterite> Like, putting `@[Foo(x: 1)]`, `@[Foo(x: 2)]` and so on on top of a single type/method/var
<FromGitter> <bew> Kind of like in #3620 ?
<FromGitter> <asterite> Yes, exactly that
<FromGitter> <bew> I'd say, we can try, and see how it goes!
<FromGitter> <asterite> I guess for now I'll start without that multiplicity thing, and with it not being "type-safe" (that is, you won't need to declare attributes)
<FromGitter> <bew> so where would the custom attributes come from for your start implem' ?
<FromGitter> <bew> I just don't get what you mean by "not being type-safe"
<FromGitter> <asterite> Like, you can do `@[JSON(key: "x")]` on top of an instance variable, and from macros you'd do `var.attribute("JSON")` to fetch that
<FromGitter> <asterite> but if you accidentally type `@[JSOON(key: "x")]`, that won't give a compile error saying "undefined attribute"... but the JSON mapping thing will probably give an error somewhere else
<FromGitter> <bew> what would have been the safe way?
<FromGitter> <asterite> at least as a start... then we could thing about declaring what attributes exist, and where
phaed has quit [Remote host closed the connection]
<FromGitter> <bew> yeah ok, looks good :)
<FromGitter> <asterite> Something like `@[Attribute(JSON, target: :instance_var)]` (that declares an attribute)
<Yxhuvud> tbh, I'd prefer stuff that modifies what `property` does to be an argument to it. I'm not a big fan of annotations.
<FromGitter> <asterite> Yxhuvud What do you mean?
<FromGitter> <bew> oh, so the `@[JSOON(key: "x")]` attribute would raise directly saying that there is no such attribute, right?
<FromGitter> <eliasjpr> @asterite isn’t `record` just a wrapper for `struct`? Also the NameTuple approach would allow to do something like `response[#{some_key}]` not that you cannot do that with Hashes, but inmutable hashes there do not exist
<Yxhuvud> something like `property x, serializers: [JSON: : x, YAML: x]`
<Yxhuvud> well [] => {}. Was writing while thinking, never a good idea
<FromGitter> <bew> Yxhuvud: `property` is a macro, what would that expand to?
<Yxhuvud> @bew: something that generates that can handle whatever you want the meta attributes to handle.
<FromGitter> <bew> sorry, I don't understand what you mean
<FromGitter> <asterite> The thing is, the serialization logic right now is generated at compile-time
<FromGitter> <asterite> and attributes will be available to query at compile-time
alex`` has joined #crystal-lang
<FromGitter> <asterite> so we have to store that somewhere... just adding arguments to `property` won't work
<FromGitter> <asterite> unless we store that info at runtime... which is something that I think can't be done in this language
<FromGitter> <asterite> plus, attributes are super generic... serialization is one thing, but I can imagine everyone will come up with really neat stuff with them
<oprypin> asterite, how about making them feel less like one-liner hacks by moving them inside the class body?
<FromGitter> <asterite> oprypin what do you mean? the declaration or the usage?
<oprypin> declaration
<oprypin> would look nice to have some way to define serialization and then call json.mapping and possibly other things to utilize it
<FromGitter> <asterite> I'm not following
<oprypin> ok just `@[Attribute(JSON, target: :instance_var)]; class A` -> `class A; Attribute(JSON, target: :instance_var)`
<oprypin> something, i dunno
<FromGitter> <asterite> And then you'd use it like `@[A::JSON]`?
<FromGitter> <asterite> I thought about that, and it could work, yes
<FromGitter> <asterite> But `@[JSON]` is just shorter, not sure why we'd need to add namespaces just now
<oprypin> what
<oprypin> oh i see what this is
<oprypin> no i mean the usage
<FromGitter> <asterite> Ot, it'll be like `class Foo; property x : Int32; include JSON::Serializable; end`
<FromGitter> <asterite> that would make `Foo` serializable, and all properties in it be serializable too
<FromGitter> <asterite> If you wanted `x` to parse/serialize from `y`, you'd do:
<oprypin> that's what i was going for
<FromGitter> <asterite> `class Foo; @[JSON(key: "y")] property x : Int32; include JSON::Serializable; end`
<oprypin> that's very nice
<FromGitter> <asterite> So much nicer than the current `JSON.mapping`
<FromGitter> <asterite> And then you could also have `include Object::Constructor` or something like that, to define a constructor from all fields... I guess it's also useful in combination with `JSON::Serializable`
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
<FromGitter> <asterite> Hmm... actually, I can't seem to find a way for that to work
<FromGitter> <asterite> Something like that: https://carc.in/#/r/3wsv
<FromGitter> <asterite> So good we have NamedTuples, otherwise that wouldn't work :-P
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <bew> hehe NamedTuple are useful afterall :P
<FromGitter> <bew> @asterite would be nice to have this work: https://carc.in/#/r/3wsy
<FromGitter> <bew> (add custom initializer, in addition to the automatic one)
<FromGitter> <asterite> Yes, maybe. I imagine the automatic one to just be enough. If 42 is the default age, the AutoConstructor will work once we merge https://github.com/crystal-lang/crystal/pull/5974
<FromGitter> <bew> @asterite I would do you autoconstructor that way though: https://carc.in/#/r/3wt6 (no idea why there's thats yntax error)
<FromGitter> <asterite> though I don't know how to make it work with positional arguments
<FromGitter> <asterite> it doesn't work because the macro must be expanded to a correct program
<FromGitter> <asterite> but it can't be done
<FromGitter> <asterite> you'd have to put that inside a `macro finished`, I think... or something like that
<FromGitter> <bew> oh yeah sure, shit
<FromGitter> <asterite> but even then it doesn't work because when that's reached, the type of instance vars aren't computed yet
<FromGitter> <asterite> Maybe differing `macro finished` a bit... I don't know...
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
<FromGitter> <eliasjpr> > Matz: I really, really hope so, and Vlad's work looks pretty promising. We set some criteria for Ruby 3x3, one of which is that we don't want use an existing JIT library; LLVM or something like that, because we don't control those things. Their API might change, or the project may be abandoned. Another criteria for the 3x3 project was to be as portable as possible, which is kinda difficult. You know, the
<FromGitter> ... other languages like, say, Crystal or Julia are using LLVM, but we cannot use that kind of thing if we want portability. The Ruby language itself is a pretty long-running project. Ruby itself is 25 years old, we can't rely on comparatively short-lived projects. ⏎ ⏎ Read https://blog.heroku.com/ruby-mjit?c=7013A000002XLseQAG& ... [https://gitter.im/crystal-lang/crystal?at=5ada446c62316e0505e164af]
<FromGitter> <asterite> Yes, Matz is wise. Crystal has a lot of slowdowns because of the so many dependencies
<FromGitter> <asterite> Go is another language which doesn't have many (any?) dependencies
alex`` has quit [Quit: WeeChat 2.1]
<Yxhuvud> well, they have the resources to have people hired to implement stuff themselves.
<Yxhuvud> are there any news of the full time dev that company paid for? any details of how that will work?
greengriminal has joined #crystal-lang
alex`` has joined #crystal-lang
<RX14> yes there are details :P
<FromGitter> <Sjoerrdd> Is Crystal production-ready?
<FromGitter> <j8r> no, specially if you don't write tests and do load testing for your app
<RX14> no
<FromGitter> <Sjoerrdd> What is an alternative language that I should use for my project? :thinking:
<FromGitter> <eliasjpr> that must be like the 4th time asked today
<FromGitter> <Sjoerrdd> :P
<FromGitter> <j8r> Any techs aside, you should not worry much if your app pass tests
<FromGitter> <j8r> and you have HA
duane has quit [Ping timeout: 276 seconds]
duane has joined #crystal-lang
kurko__ has joined #crystal-lang
<07IACTHV7> crystal/master 27faaee Ary Borenszweig: Merge pull request #5974 from asterite/feature/macro-default-value...
<07IACTHV7> crystal/master 434c920 asterite: Add `MetaVar#defualt_value` and `MetaVar#has_default_value?`
<07IACTHV7> [crystal] asterite pushed 2 new commits to master: https://git.io/vpmx0
<5EXAAYD0T> [crystal] asterite closed pull request #5974: Add `MetaVar#defualt_value` and `MetaVar#has_default_value?` (master...feature/macro-default-value) https://git.io/vpmEf
<DeBot> https://github.com/crystal-lang/crystal/pull/5974 (Add `MetaVar#defualt_value` and `MetaVar#has_default_value?`)
<DeBot> https://github.com/crystal-lang/crystal/pull/5974 (Add `MetaVar#defualt_value` and `MetaVar#has_default_value?`)
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> @RX14 I thought we needed 2 core reviewers even when a core dev makes the PR (to allow to have at least 2 other pairs of eyes on the changes)
rohitpaulk has quit [Ping timeout: 256 seconds]
duane has quit [Ping timeout: 240 seconds]
That_Guy_Anon has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
kurko__ has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <bararchy> RX14 what details? :)
shalmezad has quit [Quit: Leaving]
<RX14> @bew no?
<RX14> it's always been "2 core team members need to sign off"
<RX14> even if one of them is the one who wrote thr PR
<RX14> if it's a big PR i'll usually wait for more reviews though
<FromGitter> <bew> oh ok, makes sense, no idea why I thought this had been changed
greengriminal has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#27faaee (master - Merge pull request #5974 from asterite/feature/macro-default-value): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/369304740
<DeBot> https://github.com/crystal-lang/crystal/pull/5974 (Add `MetaVar#defualt_value` and `MetaVar#has_default_value?`)
greengriminal has quit [Quit: This computer has gone to sleep]
<oprypin> no, there definitely was a mention that it's nice to get 2 reviews anyway
pbodev1 has quit [Quit: ChatZilla 0.9.93 [Firefox 56.0/20170903140023]]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<RX14> at the end of the day, when to merge is disgression, I was just stating the minimum
duane has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 240 seconds]
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 256 seconds]
alex`` has quit [Quit: WeeChat 2.1]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
rain1 has quit [Quit: Leaving]
<FromGitter> <girng> i'm back
<crystal-gh> [crystal] RX14 closed pull request #5962: Expand Regex to allow querying for metacharacters (master...regex-special-char) https://git.io/vpIjw
greengriminal has joined #crystal-lang
<crystal-gh> [crystal] j8r opened pull request #5976: Improve the syntax of some if blocks to one line (master...if_cleanups) https://git.io/vpYLD
<FromGitter> <j8r> We missed you, and we didn't even notice - thanks to letting us know @girng ;-)
<FromGitter> <girng> i will always be here
<FromGitter> <j8r> But you have to rest and eat, no? Or you are a robot
<FromGitter> <girng> yeah, top ramen and eggs
<travis-ci> crystal-lang/crystal#980492c (master - Expand Regex to allow querying for metacharacters (#5962)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/369351808
<DeBot> https://github.com/crystal-lang/crystal/pull/5962 (Expand Regex to allow querying for metacharacters)