RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.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
zachk has quit [Quit: Leaving]
alex`` has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <Willamin> Is there a general opinion or vision for shard size? More specifically
<FromGitter> <vlazar> just don't do it a node way? :)
<FromGitter> <Willamin> Right. In the JS world, single function packages aren't frowned upon. I was wondering how this community felt about it
<FromGitter> <Willamin> Personally, I don't mind them, but wanted to get some other opinions :D
<FromGitter> <vlazar> the situation in node is most likely coming from the fact stdlib in JS is too small and buggy
<FromGitter> <vlazar> with great stdlib in Crystal we wouldn't end up with too many small shards anyways I think
greengriminal has quit [Quit: Leaving]
jeet has quit [Ping timeout: 240 seconds]
<FromGitter> <rishavs> Is there a way to attach a variable/data hash to the Http::Server Response? I want to create a data passing mechanism which dies with the context.
<FromGitter> <rishavs> Something akin to passing a store object through the coontext in the node/react world
<FromGitter> <Willamin> It might not be the *best* way, but you can always reopen the HTTP::Server::Response class and add your data hash as needed. Probably only do that as a last resort
<FromGitter> <rishavs> I am kinda scared of trying that. I was hoping we had something like a an ibuilt `add` method 😄
alex`` has joined #crystal-lang
<FromGitter> <vlazar> for example in Lucky the HTTP::Server::Context is extended for storing cookies and session https://github.com/luckyframework/lucky/blob/master/src/lucky/context_extensions.cr#L12-L18
<FromGitter> <vlazar> although cookies and session I guess make more sense than just data passing mechanism
jeet has joined #crystal-lang
alex``` has joined #crystal-lang
alex`` has quit [Ping timeout: 264 seconds]
<FromGitter> <codenoid> who's greg https://www.freshports.org/lang/crystal/
snsei_ has joined #crystal-lang
<FromGitter> <bew> @codenoid looks like he's the maintainer of the freebsd package for Crystal
snsei_ has quit []
wontruefree has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] paulkass opened pull request #6306: Implemented #2770 (master...adding-punycode-to-openssl) https://git.io/fwlYe
<FromGitter> <codenoid> i can't install crystal on OpenBSD
<FromGitter> <bararchy> Morning :)
<FromGitter> <bararchy> @codenoid did you manage to create the first Crystal malware ? hahaha
wontruefree has quit [Quit: bye]
<FromGitter> <bendietze_twitter> Crorm? 😆
<FromGitter> <bararchy> XD
<FromGitter> <bararchy> I'm playing around with web sockets, I want to see the response from an ECHO server, but htis seems to fail ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b38938b60c387078353ad00]
<FromGitter> <bararchy> as in, the `puts message` won't show anything
<FromGitter> <bararchy> what am I'm missing
<FromGitter> <bararchy> Oh, ok I missed the ws.run part
<FromGitter> <rishavs> > for example in Lucky the HTTP::Server::Context is extended for storing cookies and session https://github.com/luckyframework/lucky/blob/master/src/lucky/context_extensions.cr#L12-L18 ⏎ ⏎ Thanks vlad. I assume that the basic idea is same in both cases. Would be interesting to see how Paul added a store in the context
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <bendietze_twitter> @bararchy you need a "server" who manage the connections and "client/s" who is/are bounded, or? But i never tested send and receive in one socket :) And why sleep 10? :)
<FromGitter> <bararchy> @bendietze_twitter This works: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b389d5c216ee2623e924ab4]
rohitpaulk has quit [Ping timeout: 265 seconds]
<FromGitter> <bendietze_twitter> @bararchy 😄 cool 😄
<Groogy> Morning o/
<FromGitter> <bendietze_twitter> Oh, addr is already ws, didnt saw this 😄
<FromGitter> <bendietze_twitter> 😏
<FromGitter> <bararchy> Morning Groogy, all is well ?
<Groogy> yeah, just pissed at my code ^^
<Groogy> you?
<FromGitter> <bararchy> learning about web-sockets :)
<FromGitter> <sdogruyol> Morning 👋
<FromGitter> <bararchy> Morning @sdogruyol
<Yxhuvud> groogy: pissing at your code is good, it mean you learnt something.
<Groogy> haha
<Yxhuvud> it is less good when you realize you have to spend the next couple of weeks rewriting old crap though
<Groogy> more like putting together vertices for my ismoetric view and keeping correct depth was more annoying than it should have been xD
<Groogy> Well that's sort of what I am :P
<Groogy> rewriting old crap to make depth be always correct
DTZUZU has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <bararchy> Is ego working yet?
<Groogy> in first you can see a tree cutting into a building, I am fixing that and it came from my rework on how entities on tiles work
<FromGitter> <bararchy> cool!
<Groogy> @bararchy haha no
<FromGitter> <r00ster91> SFML?
<FromGitter> <bararchy> @r00ster91 nope, Groogy is bulding a pure crystal engine
<Groogy> GLFW to setup window, rest is all mine
<FromGitter> <r00ster91> ah
<FromGitter> <bararchy> Did you work on Save\Load already?
<Groogy> yepp
<FromGitter> <bararchy> how did you went with that? msgpack? or you're own format?
<Groogy> YAML, besides the map data that is huge which is just binary data packed together
<Groogy> there's a framework for it all in boleite that helps you out
<Groogy> and makes it possible for you to establish references to persistent objects easier
<FromGitter> <bararchy> cool!
DTZUZO has quit [Ping timeout: 260 seconds]
<Groogy> for example how a definition file looks like https://github.com/Groogy/ego/blob/master/dist/data/entities/basic.yml
<FromGitter> <bararchy> well, at least they have "foods"
lvmbdv has joined #crystal-lang
<FromGitter> <bararchy> XD
<Groogy> ^^
DTZUZO has joined #crystal-lang
<Groogy> though right now working on making tiles smaller in smaller-tiles branch and let entities occupy several tiles at once. It will help some game design decisions and make some things simpler but it sure as hell is making rendering way harder xD
rohitpaulk has joined #crystal-lang
<FromGitter> <sdogruyol> how's the performance in general?
<FromGitter> <bararchy> Groogy do you render on a 2nd Thread?
<Groogy> nope, tthere's no threads yet in crysttal is there?
<Groogy> also performance is generally good so far
<FromGitter> <bararchy> Groogy you can use this trick: https://oprypin.github.io/crsfml/tutorials/system/thread.html
<FromGitter> <bararchy> like what oprypin did with crSFML
<FromGitter> <bararchy> andhere: https://oprypin.github.io/crsfml/tutorials/graphics/draw.html ⏎ at "Drawing from threads"
jeet has quit [Ping timeout: 264 seconds]
<Groogy> eh don't need that, since I do the OpenGL myself I can manage the rendering from several threads way better
<Groogy> SFML does some stupid things there
<Groogy> though why aren't we allowed to use the crystal thread class?
jeet has joined #crystal-lang
<Groogy> I would prefer that than adding another dependency to Boleite just for one single class
<FromGitter> <bararchy> you can use crystal Thread
<FromGitter> <bararchy> also Thread.mutex
<FromGitter> <bararchy> "_
<FromGitter> <bararchy> :)
Ven`` has joined #crystal-lang
Ven`` has quit [Client Quit]
<Groogy> I can? I can't see it in the documentation though
<Groogy> so I just assumed it was just hidden away somehow
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
edwardloveall[m] has joined #crystal-lang
jeet has quit [Quit: WeeChat 2.1]
jeet has joined #crystal-lang
ua has joined #crystal-lang
ua_ has quit [Ping timeout: 248 seconds]
<lvmbdv> woot thread?
<lvmbdv> since when?
<FromGitter> <bararchy> Since ever haha
<lvmbdv> wish they were in the docs
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fwlRL
<crystal-gh> crystal/master 75ba915 Ary Borenszweig: Let IO#sync only affect writes, introduce `IO#read_buffering?` and use it in urandom (#6304)
<FromGitter> <bararchy> They are considered an "internal implementation"
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fwlRY
<crystal-gh> crystal/master ad56b14 Ary Borenszweig: Fix formatting of `{ {1}.foo, ...}` (#6300)
<RX14> whats the point of it if you always immediately segfault?
<travis-ci> crystal-lang/crystal#ad56b14 (master - Fix formatting of `{ {1}.foo, ...}` (#6300)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/398824196
<DeBot> https://github.com/crystal-lang/crystal/pull/6300 (Fix formatting of `{ {1}.foo, ...}`)
<travis-ci> crystal-lang/crystal#75ba915 (master - Let IO#sync only affect writes, introduce `IO#read_buffering?` and use it in urandom (#6304)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/398823995
<DeBot> https://github.com/crystal-lang/crystal/pull/6304 (Let IO#sync only affect writes, introduce `IO#read_buffering?` and use it in urandom)
<RX14> Thread.new existing is because nobody's bothred to remove it
alex``` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
<FromGitter> <sdogruyol> oh lol, I thought we've already removed `Thread` :|
<FromGitter> <bararchy> RX14 it won't always segfault and it still can be used for improved performance in certain situations https://gist.github.com/oprypin/00953b336673719dba25
<RX14> whats the point of something if you have to go out of your way and code on a tightriope to not make it segfault?
<RX14> cast fails? segfault
<RX14> not_nil! fails? segfault
<FromGitter> <bararchy> Well, I didn't say its good, just said it can be used in *certain* situations hahaha
<FromGitter> <bararchy> I do prefer proper working multi-threading using spawn Fiber/Channel but I use what I can
rohitpaulk has quit [Ping timeout: 265 seconds]
<FromGitter> <bararchy> RX14 nice job on windows file dir spec
<RX14> yeah nice job failing CI
<RX14> fixed now though :)
jeet has quit [Ping timeout: 260 seconds]
<RX14> I need to fix the stdlib specs running slowly
<RX14> used to be a quick 10 second smoketest
<RX14> now it takes ages like 30 seconds
<FromGitter> <valamorgon> how can I parse nested json string to hash?
<RX14> what d you mean by "nested"
<RX14> the resulting hash needs a type
rohitpaulk has joined #crystal-lang
<FromGitter> <valamorgon> I meant I have a json string which array of object, which also has properties that are object or arrays etc.
<RX14> if it has a schema (thing usually do), then use JSON.mapping
jeet has joined #crystal-lang
<FromGitter> <bararchy> @valamorgon could it be you're just talking about JSON.parse ?
<FromGitter> <valamorgon> @bararchy the propblem with json.parse is it returns json::any
<FromGitter> <bararchy> @valamorgon and you want a predefined class/object to work with? If so use what RX14 suggested
<FromGitter> <valamorgon> can I loop it after crystal 25.0 ? or can I add new key value to it?
<FromGitter> <valamorgon> I actually want to use lazy hashes like in javascript
<FromGitter> <valamorgon> but maybe not possible
<FromGitter> <bararchy> You can go over it recursively, using .is_h? Or is_a? Etc..
<FromGitter> <bararchy> Make sure you use 0.25.1 so .clone and .dup will work :)
<FromGitter> <valamorgon> I actually used to_h but it didnt work for me when I tried to add a new k,v as string string
<RX14> at the end of the day, crystal is typed and you're going to have to change how you code in it
<FromGitter> <valamorgon> then I saw .hash(hasher) so I thought maybe there is a simple way to achive it
<RX14> it's rare that JSON.mapping is impossible to use
<RX14> after all, there must be a schema or your code couldn't understand it
<FromGitter> <valamorgon> yeah but it could understand hash right? but there is no way to convert it to hash currently?
<RX14> not in exactly the same way as 0.24.2, no
<RX14> you get a Hash(String, JSON::Any)
<RX14> but JSON::Any isn't a good thing anyway
<RX14> JSON.parse should go, you should have to use JSON::Any.from_json, and the docs should be updated to show JSON::Serializable front and center with JSON::Any as a footnote
<RX14> JSON::Any is still needed but it's not a good place to start for most people
akaiiro has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <j8r> Since we are talking about, can we have a partial mapping of a json file?
<FromGitter> <j8r> I've for example a list, but the elements inside can change. Or even at the top level, there are always-here keys but other can be also present
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<crystal-gh> [crystal] asterite opened pull request #6307: Fix: missing codegen cast from metaclass union to virtual metaclass (master...bug/6298-cast-metaclass-union-to-virtual-metaclass) https://git.io/fwKnT
wontruefree has joined #crystal-lang
nobbi has joined #crystal-lang
nobbi has quit [Client Quit]
akaiiro has quit [Remote host closed the connection]
wontruefree has quit [Quit: bye]
wontruefree has joined #crystal-lang
<FromGitter> <trans> The problem is when the keys are customizable by the user. There is no way to know what the value type might be.
<FromGitter> <rishavs> What does this operator means? `||= `Just noticed them in Lucky's context extender
rohitpaulk has joined #crystal-lang
<FromGitter> <fridgerator> memoize
<FromGitter> <fridgerator> sets the variable, unless it is already set
<FromGitter> <rishavs> thanks
<Yxhuvud> rishavs: x ||= y is basically expanded to x || x = y
<FromGitter> <rishavs> Thanks! got it now
jeet1 has joined #crystal-lang
jeet has quit [Ping timeout: 248 seconds]
<RX14> no, it's x = x || y
<RX14> as in if x is already set (not falsey), it's x, otherwise initialize it with y
jeet2 has joined #crystal-lang
jeet1 has quit [Ping timeout: 260 seconds]
<FromGitter> <asterite> It's actually what they said before
<FromGitter> <asterite> The assignment is done only if x is falsey
rohitpaulk has quit [Ping timeout: 248 seconds]
<Yxhuvud> easy to demonstrate with setters and getters with side effects: https://gist.github.com/yxhuvud/f9fc14095b07ce33f2650a592757d307
sz0 has joined #crystal-lang
<crystal-gh> [crystal] kostya opened pull request #6308: replace mapping with serializable in compiler (master...remove_using_mapping_in_compiler) https://git.io/fr9kA
wontruefree has quit [Quit: bye]
wontruefree has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
snsei has quit [Ping timeout: 256 seconds]
alex`` has quit [Quit: WeeChat 2.1]
<FromGitter> <velddev> hey hey! dows anyone here know how to downgrade crystal?
<FromGitter> <j8r> Depends of your system @velddev
<FromGitter> <j8r> You can also download whatever release of crystal and use it (or add in the `PATH`)
sz0 has joined #crystal-lang
wontruefree has quit [Ping timeout: 256 seconds]
wontruefree has joined #crystal-lang
wontruefree has quit [Ping timeout: 276 seconds]
wontruefree has joined #crystal-lang
wontruef_ has joined #crystal-lang
wontruefree has quit [Ping timeout: 264 seconds]
duane has quit [Ping timeout: 248 seconds]
duane has joined #crystal-lang