Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Cyrus1 has quit [Ping timeout: 276 seconds]
baweaver_away has quit [Excess Flood]
baweaver has joined #crystal-lang
baweaver has joined #crystal-lang
baweaver has quit [Changing host]
Cyrus1 has joined #crystal-lang
ukd1 has joined #crystal-lang
ukd1 has quit [Remote host closed the connection]
Cyrus1 is now known as Cyrus
qard has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Quit: qard]
alex`` has joined #crystal-lang
* hightower2
misses a shard for gettext!
<hightower2>
would be so great if there was one
<FromGitter>
<bew> for what? what do you miss?
<hightower2>
The bindings for gettext
<FromGitter>
<bew> oooh ok, nvm
DTZUZO has quit [Ping timeout: 240 seconds]
baweaver is now known as baweaver_away
rohitpaulk has joined #crystal-lang
<FromGitter>
<straight-shoota> hightower2 gettext bindings should be fairly easy, it literally just exposes a few functions. Your probably only going two need 1 or 2.
<FromGitter>
<straight-shoota> But why use gettext?
<hightower2>
straight-shoota: right, especially since the data types involved are also very simple. But, how do you mean, what would you use instead of it?
DTZUZO has joined #crystal-lang
Groogy has quit [Disconnected by services]
Groogy2 is now known as Groogy
<Groogy>
Morning! o/
<FromGitter>
<girng> Morning!!
<FromGitter>
<girng> 12:57 am here xD
Groogy_ has joined #crystal-lang
<FromGitter>
<straight-shoota> I would use some I18n library like Rails's. There are a few shards I think, but don't know how good they are
<FromGitter>
<straight-shoota> I wouldn't recommend gettext
<FromGitter>
<straight-shoota> There are other opinions, though
<hightower2>
straight-shoota: ah that's what you mean. Yeah, we use TechMagister's I18n in one project, but I appreciate the ecosystem that exists around gettext
<hightower2>
morning groogy'o
<FromGitter>
<straight-shoota> The issue with gettext is that the source language is directly edited in the code. It's not easy to offload copywriting to non-devs. There are issues when the same text in source language is used at multiple locations but would need different translations depending on context, decent plural formatting etc.
<FromGitter>
<straight-shoota> IMO it is a far better design to just declare in the source code that you need a text here and give it a descriptive, context-aware name.
<hightower2>
Well, yeah, true... it's not easy to offload copywriting in the primary language because the primary language is specified in-place. But if I am not mistaken, what's preventing you from just using contextual name and providing even the primary translation in a translation file?
<FromGitter>
<straight-shoota> You could probably do that but what would be the point in using gettext for this when there are far better designs for this?
<hightower2>
Ok, thanks for the advice. (I always assumed other solutions were inferior to gettext. Will re-check)
rohitpaulk has quit [Ping timeout: 265 seconds]
<oprypin>
straight-shoota, lol you could tell copywriters to translate to the same language as well. forcing them to be passive-aggressive with devs ;)
<oprypin>
also i wouldn't trust anyone to write better UI labels than myself
<oprypin>
and I don't see any advantage of using a fake identifier in place of real language even in source code
<oprypin>
girng, you can use `self.online_count += 1`
<FromGitter>
<girng> got it, working now
<FromGitter>
<girng> thanks @oprypin
<oprypin>
seems not explained in docs
<oprypin>
assignment defaults to local variables
<FromGitter>
<girng> i like crystal bcz i was experiencing that in my main code. and i just whipped it a seprate example to isolate the case. syntax is joy to work with, easy to remember
<oprypin>
good job
DTZUZO has quit [Ping timeout: 264 seconds]
<FromGitter>
<straight-shoota> @oprypin Translations to not belong in the source code. If you provide an additional po file with a translation for the source language anyway, I really don't see any benefit for gettext. Different languages can behave differently depending on context. You need context to be able to properly translate something. You can use pgettext to add context, but again, if you do that (and you should for every
<FromGitter>
... translation string), you could diretly use something more appropriate for this. When using hierarchical, context-aware message IDs this is all enforced by the very design.
<FromGitter>
<girng> for some reason, i did some more testing with a lot of connections. and it does seem like my ram usage goes down. im using WSL though, is that why?
<FromGitter>
<straight-shoota> And gettext has considerable shortcomings. I don't think you can have a string with two different pluralizations?
<FromGitter>
<girng> i loaded up 5k new tcp connections, of which all create a new Player class, my memory goes to 100mb ram, then when i disconnect them all, fluxuates around to around 40mb memory usage. and i rinse and repeat this, and memory usage keeps going back down. but i thought boehm's GC doesn't free memory back to the OS, what is going on??
<FromGitter>
<girng> ok so i went up to 10k connections. it went up to 125mb ram or so, but now when all disconnect, it hovers to 70mb instead of 40. so, i think the "new connection sockets" in the TCP server internally get free'd up, but the objects that were created in crystal (all my player classes), are still there in memory ready to be re-used INSTANTLY
<oprypin>
likely
<RX14>
no
<RX14>
it's the fiber stacks
<RX14>
the fiber stacks get GC'd
<RX14>
but the allocated memory for stuff on the heap used by those fibers does not
<RX14>
now that's hard to explain
<FromGitter>
<girng> in any caseim happy the memory usage does go down a bit when the tcp connections get dropped. i thought originally since boehm doesnt return any memory to OS, that the memory would be high that entire time
<RX14>
boehm doesn't return memory to the OS
<RX14>
it's just that some of the memory isn't allocated via boehm
<FromGitter>
<girng> i thought crystal uses boehm
<RX14>
it does
<RX14>
but there's one specific small part that does not
<FromGitter>
<girng> o, so that is what im experiencing
<RX14>
yea
<FromGitter>
<girng> ima tuck my tail in and get back to coding then was just kinda curious :O
<FromGitter>
<girng> ROFL
<FromGitter>
<girng> now, my server just went back to 25mb memory usage
<FromGitter>
<faustinoaq> I guess I can use `crystal tool expand` 😄
<mps>
FromGitter: I read it but some things are confusing to me. I don't know ruby and looks like the docs written for those who are fluent in ruby, it's my impression
<RX14>
mps, in crystal, passing closures to methods is really *really* common
<RX14>
so having a special syntax (and performance enhancements that come with the special syntax) for it makes a lot of sense
<RX14>
for example we don't have for loops in crystal
<mps>
and we can put more parameters in the ||? like that |foo, bar|
<RX14>
mps, yep
<RX14>
|| just act like ()
<RX14>
a bit like
<mps>
enlightened*
<mps>
but for function and method call we can use ()
<RX14>
for calling you always use ()
<mps>
so, || is for closures only if I understand
<RX14>
|| is *only* for block arguments
<RX14>
calling blocks? ()
<RX14>
calling methods? ()
<RX14>
calling procs? ()
<RX14>
defining methods? ()
<RX14>
defining block args? ||
<RX14>
yeah, it's weird
<mps>
ah, I see
<RX14>
but () conflicts, it'd create ambiguous syntax
<mps>
ok, I have to adapt my eyes to that
<RX14>
consider foo { (arg1, arg2) }
<RX14>
actually thats a bad example
<RX14>
consider foo { (bar) }
<mps>
ok
<RX14>
that could be parsed as calling the method `foo`, with a block tat takes 1 argument named bar
<RX14>
but it could also be parsed as calling the method `foo`, with a single call to the method `bar`
<RX14>
e.g. treat `bar` as an expression, remove the unneccesary brackets
<mps>
yes, I see
<RX14>
yeah
<RX14>
so ruby had to change the syntax to be weird
<RX14>
glad you understand
<mps>
RX14: thank you very much, you helped me a lot
<RX14>
no problem
<mps>
now I'm more confident to start crystal programming despite the fact I have to learn a lot
<RX14>
yeah, ruby syntax is really a family of it's own, not similar to C at all
<RX14>
or python
<mps>
it was not so strange at the basic level to me because I know perl
<mps>
I grasped basic in few hours
<RX14>
cool
<Vexatos>
Julia does it in a very similar way though, it also has special syntax for block args, although it is a keyword instead of a specific glyph
<mps>
but some thing are really strange to me, don't have courage to ask about yield, yet :)
<RX14>
at least C and Go will teach you strong typing, and Go will teach you goroutines/channels (which we call fibers/channels)
<RX14>
so crystal should be fairly easy for you
<RX14>
mps, yield is just the counterpart to blocks
<RX14>
yield is how you call a block in the method
<RX14>
you define a closure using ->(arg : Type) { code } right?
<mps>
yes, that is true, fiber are like goroutine and channels looks nearly same
<RX14>
and then you call the closure using `closure.call` method
<RX14>
just as you define a block with `do/end` or `{/}`, you call a block with `yield`
<mps>
RX14: please, don't try to educate me about yield right now
<RX14>
aww but it's simple :(
<RX14>
if you check the examples I gave above it should be clear
<mps>
sorry, I wanted to make small non-offensive joke
<Vexatos>
you have crystal shards and all, why didn't you also call channels after something related to crystals
<Vexatos>
would have been funny
<oprypin>
crystals are perfefct, they dont have channels
<oprypin>
distribution channels?
<RX14>
Vexatos, we don't make any crystal references in the syntax
<Vexatos>
fair enough
<RX14>
we just make it in the librry names and commandline tools
<mps>
I think it is to soon for me to learn everything in one chat session
<RX14>
sure, but we'll still be here if you have any more questions :)
<Vexatos>
(unless an unfortunate incident or accident happens to occur)
<mps>
you are very nice, tnx :)
<mps>
I hope that I will continue with crystal, so you can expect some more questions from me
Jenz has joined #crystal-lang
Jenz_ has joined #crystal-lang
<Jenz>
mps, welcome to Crystal!
Jenz_ has quit [Ping timeout: 240 seconds]
Jenz has quit [Ping timeout: 240 seconds]
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
foca has quit [Ping timeout: 240 seconds]
foca has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 260 seconds]
<FromGitter>
<girng> I love CRYSTAL!
<FromGitter>
<Sjoerrdd> Same :D
<FromGitter>
<Sjoerrdd> I joined yesterday
DTZUZO has joined #crystal-lang
<FromGitter>
<Sjoerrdd> What was the previous language you fell in love with?
<FromGitter>
<Sjoerrdd> @girng
<FromGitter>
<girng> nodejs.. lol
<FromGitter>
<girng> javascript*
<FromGitter>
<girng> but i'm very past that now, crystal much better imo, and way easier / cleaner to read. (IMO)
<RX14>
@girng what had you used before javascript?
<FromGitter>
<girng> php *shutters in embarassment*
<RX14>
lol
<Vexatos>
At least it wasn't perl
<FromGitter>
<Sjoerrdd> Php is my job
<FromGitter>
<Sjoerrdd> Nodejs was an hobby
<FromGitter>
<Sjoerrdd> Then I moved to Elixir
<FromGitter>
<Sjoerrdd> But I didn't like Phoenix
<FromGitter>
<Sjoerrdd> So I moved back to NodeJS
<FromGitter>
<Sjoerrdd> And then I discovered Crystal
<txdv>
when pain is your job and suffering is your hobby
<txdv>
are you into bdsm?
<FromGitter>
<Sjoerrdd> ..
<FromGitter>
<Sjoerrdd> Btw
<FromGitter>
<Sjoerrdd> I'm a student (17 y/o)
<FromGitter>
<Sjoerrdd> And my mentor swears he is programming in php6
<txdv>
i swear too when i have to program in php
<FromGitter>
<Sjoerrdd> 😂😂
<FromGitter>
<Sjoerrdd> Php isn't that bad
<FromGitter>
<girng> i switched back to crystal. i made this post (https://elixirforum.com/t/how-to-read-a-32-bit-unsigned-integer-on-tcp-stream/13519), with elixir and tfinally got help and got it working. however, i went back to crystal because i gto most of my game server already written. but elixir community is very nice, but my mind doesn't grasp functional languages so i went back to crystal. but i did get elixir working
<FromGitter>
... with godot. i had to enable a dumb `big_endian` property. spent 2 days trying to fix that. if it takes me 2 days just to find that issue, then i don't have enough time to convert my game over. ⏎ ⏎ and plus, erlang's gen_tcp documentation is very confusing. crystal's cookbook, docs are much easier to read.
return0e has quit []
<FromGitter>
<j8r> this is you server or client side of your game?
<FromGitter>
<j8r> server I guess
<FromGitter>
<girng> yah
ukd1 has joined #crystal-lang
ukd1 has quit [Client Quit]
ukd1 has joined #crystal-lang
ukd1 has quit [Client Quit]
ukd1 has joined #crystal-lang
ukd1 has quit [Client Quit]
ukd1 has joined #crystal-lang
ukd1 has quit [Client Quit]
rohitpaulk has joined #crystal-lang
ashirase has quit [Ping timeout: 265 seconds]
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bmcginty_>
I've got an Array(T), and I need to get T without nils, if that's possible. So if I've got Array(String|Int32|Nil), I'm needing String|Int32 frm inside the array. I might be asking for the impossible, though.
<oprypin>
bmcginty_, certainly possible, there might even be a dedicated method for it
<crystal-gh>
crystal/master 3138b52 Julien Reichardt: Add `Hash#last_key` and `Hash#last_value` (#5760)
<FromGitter>
<faustinoaq> > If you're using an externally supplied package and worry that it might change in unexpected ways, the simplest solution is to copy it to your local repository. (This is the approach Google takes internally.) ⏎ ⏎ ^ https://golang.org/doc/faq#get_version ⏎ ⏎ ^ Really?, so no `major.minor.patch` versions? I'm trying to learn go and I found this when I was importing some dependencies 😅
<FromGitter>
<faustinoaq> > New major versions of your package must have their own repository. Put simply, each major version of your package (following semantic versioning) would have its own repository and thus its own import path. e.g. github.com/jpoehls/gophermail-v1 and github.com/jpoehls/gophermail-v2. ⏎ ⏎ ^ http://zduck.com/2014/go-and-package-versioning/ ⏎ ⏎ Ok, that's odd 😟