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
<FromGitter> <delef> @kazzkiq Why not just use record? ⏎ https://crystal-lang.org/api/0.25.1/toplevel.html#record%28name%2C%2Aproperties%29-macro ⏎ ⏎ `record User, name : String, age : Int32` [https://gitter.im/crystal-lang/crystal?at=5b5bb26112f1be71375edcc4]
<FromGitter> <Blacksmoke16> :0
<FromGitter> <Blacksmoke16> neat
<FromGitter> <delef> @asterite thank you! I rewrote my shard without recursive types 🙂
_whitelogger has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
Philpax has joined #crystal-lang
Philpax has quit [Ping timeout: 240 seconds]
<FromGitter> <DanilaFe> Heyo! I have a list of UInt16, and I'd like to write it raw to a file
<FromGitter> <DanilaFe> How would I do that?
unicornlover87 has joined #crystal-lang
<unicornlover87> hey
wontruefree has joined #crystal-lang
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b5bdefe20d248394f5ef0f3]
<FromGitter> <Blacksmoke16> @DanilaFe
<FromGitter> <Blacksmoke16> is how i would do it, not sure if there are better ways tho
unicornlover87 has quit [Quit: I found a unicorn in the next room ... brb]
<FromGitter> <basilthesecond_gitlab> Hey, I'm trying to open a socket to a server using this code: ```
<FromGitter> <basilthesecond_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b5be1dfdefc9823f51ed2fe]
<FromGitter> <basilthesecond_gitlab> this is my code, idk if ti's right, but when I run this, I get an error saying that ``` ⏎ in /usr/share/crystal/src/socket.cr:125: undefined method 'seconds' for String ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5b5be20bcb4d5b036c9fffe9]
<FromGitter> <basilthesecond_gitlab> i'm not sure if this is a bug or this is me
<FromGitter> <Timbus> @DanilaFe I think you're looking for ByteFormat: https://crystal-lang.org/api/0.25.1/IO/ByteFormat.html ⏎ To use @Blacksmoke16 's example: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b5be448f52b276ced4a241d]
<FromGitter> <Timbus> Or as shown at the link, use file.write_bytes
<FromGitter> <bew> @kazzkiq you can also do that :) https://play.crystal-lang.org/#/r/4mly
wontruefree has quit [Quit: bye]
duane has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <DanilaFe> Cool, thanks!
Yxhuvud has quit [Ping timeout: 255 seconds]
Yxhuvud has joined #crystal-lang
Groogy has joined #crystal-lang
<Groogy> Mroning! o/
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
<Groogy> is there a clever way to have a map ignore certain results? Like a nil value? Or a method that does similar
<Groogy> oooh there's compact_map nice
<FromGitter> <Qwerp-Derp> wait what determines when a new version is to be released?
alex`` has joined #crystal-lang
<Groogy> probably a bit arbitrary? Don't think they have a specific standard for what constitutes "enough changes to be new release"
<FromGitter> <Qwerp-Derp> mainly waiting for the new release to be out so i can use all of the new windows stuff
DTZUZO has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #6358: Restrict `exp.@var` to types in the same hierarchy (master...feature/6066-restrict-read-ivar-access) https://git.io/fNJnM
<FromGitter> <Daniel-Worrall> Windows isn't usable but you can always build from master
<FromGitter> <Daniel-Worrall> The main updates are workable error reporting so that the rest of the port will be smoother
<travis-ci> crystal-lang/crystal#87781a9 (master - Restrict `exp.@var` to types in the same hierarchy (#6358)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/409236476
<Groogy> If I have a FooBar:Class from a generic thing, can I somehow use that as the return type to denote an instance? I.e I want to return an instance of that and not the class
<Groogy> what I have essentially and want to achieve
<Groogy> if I try U.cast(obj) it just tells me that I am trying to cast it to Object :/
<Groogy> oh wait I can just do it to the passed variable duh
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
ua_ has quit [Ping timeout: 256 seconds]
ua has joined #crystal-lang
<Groogy> coder art 👌
<FromGitter> <delef> What I'm doing wrong? ⏎ https://carc.in/#/r/4mpn
<Groogy> don't look like you can split a when case over several {% %}?
rohitpaulk has joined #crystal-lang
<FromGitter> <straight-shoota> macro language doesn't support `case`
<FromGitter> <straight-shoota> use `if` instead
<Groogy> I am very happy that I implemented trashman, kept game running for an hour and came back and saw it used +11gb of RAM
<Groogy> time to investigate
<Groogy> (It's supposed to only be a couple of mb's as well so I was quite impressed)
<FromGitter> <delef> @straight-shoota thanks
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
Ven`` has joined #crystal-lang
Groogy has quit [Quit: WeeChat 2.1]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 244 seconds]
Groogy has joined #crystal-lang
<Groogy> Oh lol when a cache is secretly keeping objects alive
<Groogy> that was not the intent
ashirase has joined #crystal-lang
ashirase has quit [Client Quit]
ashirase has joined #crystal-lang
<oprypin> Groogy, mmmmm yes. you may be interested in weakref
ashirase has quit [Client Quit]
ashirase has joined #crystal-lang
ashirase has quit [Client Quit]
ashirase has joined #crystal-lang
<Groogy> yeah the problem was rather I was not clearing out the data I cached after my weakref returned nil :P
<Groogy> so it wasn't retaining data to the object in itself, just the cache for drawing stuff
ashirase has quit [Client Quit]
<Groogy> hmmm though value.nil? seems to never return true
<Groogy> but if I tell it to just always reset the cache completly there's no issue
ashirase has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #6442: Change WinError to get message as UTF16 string (master...jm/winerror-wchar) https://git.io/fNBXd
<Groogy> it's weird so since the memory usage at all stops growing if I just call clear on cleaning out everything, if I want to selectivly remove them then it doesn't work
<Groogy> weakptr keeps returning a value... but object obviously gets collected if I just reset everytime instead
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<travis-ci> crystal-lang/crystal#97344a3 (master - Change WinError to get message as UTF16 string (#6442)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/409325008
alex`` has quit [Quit: WeeChat 2.2]
alex`` has joined #crystal-lang
duane has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
ua has joined #crystal-lang
alex`` has quit [Ping timeout: 244 seconds]
alex`` has joined #crystal-lang
Philpax has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter> <Prutheus> Hello. I have a hash and want to convert it to json. How to do that?
<FromGitter> <Prutheus> Converting the hash to string before to_json works, but then the json is malformatted.
<FromGitter> <Prutheus> ahh it happens cause my hash contains a slice ..
<FromGitter> <straight-shoota> you need to wrap the `{ ... }.to_json` in parenthesis, otherwise the curly braces are interpreted as a block argument of `puts`
Groogy has quit [Quit: WeeChat 2.2]
Philpax has quit [Ping timeout: 260 seconds]
ma has joined #crystal-lang
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fNgi3
<crystal-gh> crystal/master 077920d r00ster: Show line numbers at link when there are filename duplicates in "Defined in:" section (docs) (#6280)
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fNgi8
<crystal-gh> crystal/master e8ec7f2 Jacob: Fix Atomic#swap with reference types (#6428)
alex`` has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] sdogruyol closed pull request #6383: Fix version check for LLVM < 6.0 (master...llvm-6.0-support) https://git.io/fNmVI
<travis-ci> crystal-lang/crystal#077920d (master - Show line numbers at link when there are filename duplicates in "Defined in:" section (docs) (#6280)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/409403452
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fNgP8
<crystal-gh> crystal/master d36a654 O_o: replace mapping with serializable in compiler (#6308)
<travis-ci> crystal-lang/crystal#e8ec7f2 (master - Fix Atomic#swap with reference types (#6428)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/409404213
<FromGitter> <Blacksmoke16> how do you guys handle consuming json from a third party api, and transforming it into what your app would use
<FromGitter> <Blacksmoke16> make a struct to consume it then do what you need in there?
akaiiro has quit [Ping timeout: 256 seconds]
<FromGitter> <sdogruyol> we had `JSON.mapping` for that, now it's `JSON::Serializable`
<FromGitter> <Blacksmoke16> i mean when its more than that
<FromGitter> <sdogruyol> more than that?
<FromGitter> <Blacksmoke16> like diff key names etc
<FromGitter> <Blacksmoke16> like having to look up additional data and such
<FromGitter> <sdogruyol> you can already do nilable, key_names, convertions e.g using those
<FromGitter> <sdogruyol> converters*