RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | 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> <proyb6> @elorest since database are faster because Crystal is single threaded but that’s not a problem for majority of the sites https://www.techempower.com/benchmarks/#section=test&runid=a2bc7ff7-4ede-456b-959d-1ba79303095f&hw=ph&test=db
<FromGitter> <dscottboggs_gitlab> @talbergs you're running into the difference between paralellism and concurrency. The primary fiber in your link yields to the first-declared fiber (the "request animation frame loop" one), which then NEVER yields. If the `sleep 0.1.seconds` or a Fiber.yield was inside of that block, it would run as expected. Well... almost https://play.crystal-lang.org/#/r/61a8
Raimondi has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> This is probably more like what you were expecting https://play.crystal-lang.org/#/r/61ah
<FromGitter> <Blacksmoke16> got this working so far
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c427af320b78635b6476f46]
<FromGitter> <Blacksmoke16> `User.new.serialize expansion: ["customer"] # => {"name":"Jim","age":12,"customer":{"name":"MyCust","id":1}}`
<FromGitter> <girng> ohh dang nice
<FromGitter> <dscottboggs_gitlab> wouldn't that require being written around the ORM?
<FromGitter> <dscottboggs_gitlab> Or at least an adapter?
<FromGitter> <Blacksmoke16> this also works i think, sec
<FromGitter> <dscottboggs_gitlab> Also, no need for an annotation ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c427c62f780a1521f320776]
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> still not sure how i want this to work
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c427d3b0a491251e31c3b5b]
<FromGitter> <Blacksmoke16> but that would work as well
<FromGitter> <Blacksmoke16> i have a branch of my granite fork working with annotations as well
<FromGitter> <Blacksmoke16> so idea was this would/could be used with a like `@[Granite::OneToOne(class: Customer)]`
<FromGitter> <Blacksmoke16> so that your relations are also just properties on the class
<FromGitter> <Blacksmoke16> idk, might put this idea on hold
<FromGitter> <dscottboggs_gitlab> yeah it really seems like the responsibilty of an ORM not a serializer
<FromGitter> <Blacksmoke16> not sure, this doesn't have to be limited to orm
<FromGitter> <dscottboggs_gitlab> good point
<FromGitter> <Blacksmoke16> i could see it also used for custom stuff, like by default dont serialize a user's resume data, but make it able to do so by expansion: ["resume"]
<FromGitter> <Blacksmoke16> which could execute a custom function
<FromGitter> <dscottboggs_gitlab> yeah I was just thinking, how it could be used for arbitrary data or for nosql database connections and stuff
<FromGitter> <Blacksmoke16> but i agree im not sold it should be an annotation tho
<FromGitter> <Blacksmoke16> could be argued either way
<FromGitter> <dscottboggs_gitlab> how would it handle *de*serialization?
<FromGitter> <Blacksmoke16> hell if i know xD
<FromGitter> <dscottboggs_gitlab> :D
<FromGitter> <dscottboggs_gitlab> idk at that point I feel like maybe you should be defining subtypes that inherit from User?
<FromGitter> <Blacksmoke16> i would think it would be read only
<FromGitter> <dscottboggs_gitlab> No, I mean like, as a person writing code as opposed to the library author, it makes more sense to me to define `UserWithCustomer < User` and then use that instead of using special properties and macros with serialization instructions, you know? idk maybe that's just me
<FromGitter> <Blacksmoke16> probably
<FromGitter> <Blacksmoke16> we have the expansion thing at work and its quite handy
<FromGitter> <Blacksmoke16> but yea, im not super sure how to best implement it atm :/
<FromGitter> <dscottboggs_gitlab> I'm sure you'll figure it out if you put your mind to it. You're the macro wizard, remember? haha
<FromGitter> <matthewmcgarvey> Is there a good library for performance testing?
<FromGitter> <dscottboggs_gitlab> does the built-in `Benchmark` not suit your needs?
<FromGitter> <dscottboggs_gitlab> https://crystal-lang.org/api/0.26.0/Benchmark.html
<FromGitter> <matthewmcgarvey> maybe, if knew about it haha
<FromGitter> <dscottboggs_gitlab> there ya go! :D
<FromGitter> <matthewmcgarvey> Yep, that’s perfect thanks
<FromGitter> <Blacksmoke16> im sure ill think of something
<FromGitter> <Blacksmoke16> i kinda want to refactor CrSerializer
<FromGitter> <Blacksmoke16> to just be an overload to `to_json`/`from_json`
<FromGitter> <Blacksmoke16> vs the such dog fooded thing it is
<FromGitter> <dscottboggs_gitlab> how does it do it now? `#serialize`?
<FromGitter> <Blacksmoke16> calling an overloaded `to_json` lol
<FromGitter> <dscottboggs_gitlab> ..so what's the difference?
<FromGitter> <dscottboggs_gitlab> haha
<FromGitter> <Blacksmoke16> exactly
<FromGitter> <Blacksmoke16> xD
<FromGitter> <dscottboggs_gitlab> I'm confused
<FromGitter> <Blacksmoke16> the idea for using a diff name was to still allow the default behavior to be used
<FromGitter> <Blacksmoke16> i.e. the stdlib `.to_json`
<FromGitter> <Blacksmoke16> ill prob do that tomorrow
<FromGitter> <Blacksmoke16> in a perfect world the stdlib would support my extra features and then it would just work :3
<FromGitter> <dscottboggs_gitlab> Hm, I think if you've `include`d CrSerializer, that's not gonna be an issue. I guess if there's like no internal way to do it in a class that could be a bit of a pain for someone...
<FromGitter> <dscottboggs_gitlab> why not define a method that implements the default behavior of to_json in the CrSerializer module?
<FromGitter> <Blacksmoke16> ill look into it
<FromGitter> <Blacksmoke16> shouldn't be too hard i think
<FromGitter> <dscottboggs_gitlab> you could just defer that problem til it becomes an issue ;)
<FromGitter> <Blacksmoke16> ;)
<FromGitter> <Blacksmoke16> well that was easy
<FromGitter> <dscottboggs_gitlab> what's that?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c42879e35350772cf539d42]
<FromGitter> <Blacksmoke16> why didnt i just do that from the start
<FromGitter> <Blacksmoke16> gotta do the other types but easy enough
<FromGitter> <dscottboggs_gitlab> I'm sorry, what is happening here?
<FromGitter> <dscottboggs_gitlab> what are the "groups"
<FromGitter> <Blacksmoke16> had to override the standard `to_json` to take the groups
<FromGitter> <dscottboggs_gitlab> I see
<FromGitter> <Blacksmoke16> im basic just building on the standard lib's JSON::Serializable stuff, but with added functionality
<FromGitter> <dscottboggs_gitlab> that won't cause other issues? I've always been a bit wary of reopening
<FromGitter> <Blacksmoke16> like what?
<FromGitter> <dscottboggs_gitlab> like if someone else adds a version of Object#to_json that also has an Array(String) as its second argument or doesn't specify a type
<FromGitter> <Blacksmoke16> Hmm
<FromGitter> <Blacksmoke16> I'll worry about that when/if it becomes an issue
<FromGitter> <Blacksmoke16> Plus if you use a different param name I'm *pretty sure* it would be fine
<FromGitter> <dscottboggs_gitlab> nope
<FromGitter> <girng> finally syncing player's items from the db to the client's properties (on the gameserver) this is getting fun
<FromGitter> <dscottboggs_gitlab> that only matters if you're using named arguments (which is why I use named arguments religiously), otherwise it just checks the type
<FromGitter> <dscottboggs_gitlab> and if the argument has a version which doesn't specify a type, that overload interferes with *any* overload with the same number of arguments
<FromGitter> <dscottboggs_gitlab> ayy there you go
<FromGitter> <girng> i also don't really care about doing this dumb array matrix on the server. if a player wants to disassemble the game client, find the right send cmd, etc and put a couple more items in their inventory, go for it LOL
<FromGitter> <dscottboggs_gitlab> @girng
<FromGitter> <dscottboggs_gitlab> sorry, what?
<FromGitter> <girng> sorry spazzing out with game stuff in crystal
<FromGitter> <dscottboggs_gitlab> You're making a multiplayer game in crystal, yes, but what is the "dumb array matrix"?
<FromGitter> <Blacksmoke16> well yea, they would *have* to use named args when calling `to_json`
<FromGitter> <Blacksmoke16> prob is a decent solution
<FromGitter> <dscottboggs_gitlab> I suppose if you document that you *must* use named arguments, it's ok, but not everyone reads the docs lol
<FromGitter> <Blacksmoke16> :shrug: only do so much
<FromGitter> <dscottboggs_gitlab> yep
<FromGitter> <Blacksmoke16> yea this is a much better/simpler setup
<FromGitter> <Blacksmoke16> serialization specs are passing
<FromGitter> <dscottboggs_gitlab> nice :)
<FromGitter> <Blacksmoke16> will add some more so i cover all types covered in https://github.com/crystal-lang/crystal/blob/master/src/json/to_json.cr
<FromGitter> <Blacksmoke16> deserialization will just work since im using `after_initialize` anyway
<FromGitter> <Blacksmoke16> 💯
<FromGitter> <dscottboggs_gitlab> oh nice
<FromGitter> <dscottboggs_gitlab> just found those hooks the other day, very useful
<FromGitter> <Blacksmoke16> For sure, is also one that gets called after to json
<FromGitter> <girng> think of the diablo 2, their grid. it's a ` Array(Array(Int32)).new ` and when a player moves an item in their inventory, they check to see if it fits. like a tetris piece. i have most of the code for that here (https://paste.ee/p/gsAY4), but i don't want to deal with it anymore because i forgot how it works. and on the client side, i already have the collision detection in place when looting an item, so it
<FromGitter> ... will go to the right spot. so, the hacker would have to disassemble the game client, find the right CMD (packet) to sent, then send the correct position so they could store more items in their inventory. that, of which i don't really mind. if a hacker wants do to that, go ahead lol.
<FromGitter> <dscottboggs_gitlab> why couldn't they just watch the communication between the client and the server and find the command? TBH anything like that should probably be computed server-side. Like, the client says "hey I'd like to move my character to this square" and the server replies with "ok, if you do that, these events will occur.
<FromGitter> <girng> omg
<FromGitter> <girng> i don't CARE LOL i was just chatting
<FromGitter> <dscottboggs_gitlab> I mean... I was too haha sorry
<FromGitter> <dscottboggs_gitlab> sorry I was kinda being a dick ther
<FromGitter> <girng> nah you are not wrong, that's it supposed to be done on the server lol
<FromGitter> <dscottboggs_gitlab> but like it's your project and your priorites
<FromGitter> <dscottboggs_gitlab> anyway, what kinda game is it?
<FromGitter> <girng> i just found it funny that i have the power to make that decision. i'm free and not bound to do everything perfectly on the server
<FromGitter> <dscottboggs_gitlab> true
<FromGitter> <girng> but yeah i understand your concern 100% you are right that's how it should be done. i'm just different i guess, too lazy and i forgot how that code works hahaha
<FromGitter> <girng> even though i wrote it 😆
<FromGitter> <dscottboggs_gitlab> forgetting how your own code works is super common, that's what documentation is for, and why I always try to make my code as readable as possible.
<FromGitter> <girng> if i were to write it again i'd do it differently now. i've learned so much with crystal in just the span of the past few months tbh
<FromGitter> <dscottboggs_gitlab> same
<FromGitter> <girng> especially with your help with macros hahaha
<FromGitter> <dscottboggs_gitlab> yeah macros can be a tough concept
<FromGitter> <dscottboggs_gitlab> you picked a good place to learn them IMO
<FromGitter> <girng> ❤️
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <girng> @dscottboggs_gitlab yeah, regards to documentation / readability.. my nodejs server code when i used to code in notepad++ was a mess. that's why i'm really grateful for the crystal formatter...
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> Always start on v2 of your game ;)
<FromGitter> <girng> now that i think of it.. without crystal's formatter, i think my code would be extremely messy omg lol
<FromGitter> <dscottboggs_gitlab> yeah I definitely had to be taught readability conventions
<FromGitter> <dscottboggs_gitlab> @girng you're using crystal for the client but not the server?
<FromGitter> <girng> no no just the server
<FromGitter> <dscottboggs_gitlab> oh I see
<FromGitter> <girng> crystal is amazing for the server my gosh
<FromGitter> <dscottboggs_gitlab> what is the client?
<FromGitter> <girng> godot engine
<FromGitter> <dscottboggs_gitlab> seriously it is haha
<FromGitter> <dscottboggs_gitlab> oh ok
<FromGitter> <girng> @dscottboggs_gitlab check this out https://forum.crystal-lang.org/t/simple-godot-crystal-tcp-script/45
<FromGitter> <girng> i hope more godot developers use crystal for server purposes
<FromGitter> <dscottboggs_gitlab> huh, I was under the impression that godot used python
<FromGitter> <Blacksmoke16> Python like
<FromGitter> <dscottboggs_gitlab> yeah I see that now. interesting
<FromGitter> <girng> and the JSON.parse with crystal and godot work together flawlessly! for example, if your method grabs certain keys from the EXPECTED JSON::Any, like (this (https://i.gyazo.com/eae86839780a978c9beff15989d564f0.png)). if the user decides to enter any naughty input, OR, the user doesn't send the required keys or *TYPE!*. an exception will be raised. for that user's `handle_connection` fiber. so it's great for
<FromGitter> ... stability. i implemented a honey bucket flood protection system as well, which works great for chatting, certain commands, etc.
<FromGitter> <girng> when i say great for stability, i mean instead of the entire server crashing, the exception just gets called for that fiber. then if it's something bad, you can decide to socket.close them if you want LOL
<FromGitter> <girng> i only do socket.close if it's something really naughty though
<FromGitter> <Blacksmoke16> neat
<FromGitter> <Blacksmoke16> mm know you did something right when it just works doing a find replace for `serialize => to_json` and `deserialize => from_json`
<FromGitter> <girng> 😆
<FromGitter> <dscottboggs_gitlab> So, I found this (https://crystal-lang.org/api/0.27.0/toplevel.html#future%28%26exp%3A-%3E_%29-class-method) earlier, which, if you look at the source, implements a Future with error handling and states.
<FromGitter> <Blacksmoke16> neat
<FromGitter> <Blacksmoke16> try it out yet?
<FromGitter> <dscottboggs_gitlab> no not yet
<FromGitter> <Blacksmoke16> looks pretty legit
<FromGitter> <dscottboggs_gitlab> indeed. gonna delete my future repo
<FromGitter> <Blacksmoke16> :p
<FromGitter> <Blacksmoke16> alright hashed this out a bit more
<FromGitter> <Blacksmoke16> implementation is much simpler now
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c42a11aba355012a4607c72]
<FromGitter> <Blacksmoke16> imma go with it
<FromGitter> <Blacksmoke16> will be a bit non optimal till i get the annotation ORM to work with them nicely but still nice feature imo
<FromGitter> <Blacksmoke16> doesnt have to be custom type either:
<FromGitter> <Blacksmoke16> ``` @[CrSerializer::Expandable] ⏎ property customer : Int32 = 123``` [https://gitter.im/crystal-lang/crystal?at=5c42a1948ce4bb25b8d4e25c]
<FromGitter> <Blacksmoke16> works just as well
<FromGitter> <Blacksmoke16> :shrug:
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <girng> oh wow, who made that?
<FromGitter> <Blacksmoke16> idk
<FromGitter> <girng> was that chris or someone else?
<FromGitter> <Blacksmoke16> prob not
<FromGitter> <girng> that's awesome
<FromGitter> <girng> thanks
<FromGitter> <Blacksmoke16> np
<FromGitter> <girng> 🐱
<FromGitter> <Blacksmoke16> np
<FromGitter> <girng> 😆
<FromGitter> <Blacksmoke16> well just gotta write docs for this now
<FromGitter> <Blacksmoke16> who was that guy making his own serialization format?
<FromGitter> <Blacksmoke16> crson or something?
<FromGitter> <girng> this https://github.com/tefcdn/crjson ?
<FromGitter> <Blacksmoke16> yea! thanks
<FromGitter> <Blacksmoke16> wait
<FromGitter> <Blacksmoke16> no
<FromGitter> <girng> @j8r
<FromGitter> <girng> he has it i'm sure
<FromGitter> <girng> https://github.com/j8r/con
<FromGitter> <girng> this?
<FromGitter> <Blacksmoke16> yea thats it
<FromGitter> <Blacksmoke16> in theory since i scrapped the custom to/from methods, as long as each format implements an override and my logic in their own format, it should just work with whatever format
<FromGitter> <Blacksmoke16> i.e. con, yaml, xml, etc
<FromGitter> <Blacksmoke16> might do some testing with it since its similar to json
<FromGitter> <girng> interesting
<FromGitter> <Blacksmoke16> ill save that for tomorrow :p
<FromGitter> <girng> =]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <girng> ```code paste, see link``` ⏎ ⏎ why doesn't the last rescue clause have a variable? if i add a variable, it doesn't get called [https://gitter.im/crystal-lang/crystal?at=5c42efd4cb47ec300069b0a5]
<FromGitter> <girng> okay nvm. it's not a chain
<FromGitter> <girng> it catches that 1 EXCEPTION and that's it
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <talbergs> @dscottboggs_gitlab thank you so mutch for explanation. Very mutch appreciated.
<FromGitter> <talbergs> ```render_us && render_us.each <-&render``` [https://gitter.im/crystal-lang/crystal?at=5c430d2f0a491251e31f7b0c]
<FromGitter> <maiha> render_us.try(&.each(&.render))
<FromGitter> <talbergs> Thank you!
<FromGitter> <girng> OMG i did it all by myself https://play.crystal-lang.org/#/r/61fg
<FromGitter> <girng> no help at all! go meeeeeee!!
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> @girng gj!
<FromGitter> <j8r> GG, GirnG
<FromGitter> <girng> LOL, gg
<FromGitter> <girng> ty
<FromGitter> <girng> funny cause my adminer.php csv exporter, some reason exports my csv data with 1 line at the end of the file. guess what baby??? `data.chomp` HAHAH it works greaatt!
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
mps has joined #crystal-lang
<FromGitter> <Blacksmoke16> well now i gotta redo all my specs to test yaml too now
<FromGitter> <Blacksmoke16> why do i make more work for myself :p
_whitelogger has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <drujensen> @vladfaust I think you want to hash the string instead of the struct/class. you can override https://crystal-lang.org/api/0.27.0/Object.html#hash%28hasher%29-instance-method
<FromGitter> <vladfaust> @matthewmcgarvey it's not consistent across runs
<FromGitter> <vladfaust> @drujensen I can have other things than Strings
<FromGitter> <vladfaust> If you don't mind, here is some code
<FromGitter> <vladfaust> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4351b09bfa375aab288c19]
<FromGitter> <vladfaust> I'm implementing a job processing system and want to have flexible concurrency system with arbitrary arity of values to check the limits on. I hope you get the idea
<FromGitter> <vladfaust> And also ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4352271cb70a372a048522]
<FromGitter> <vladfaust> So, the value could be anything and I expected `.hash` to be consistent
<FromGitter> <matthewmcgarvey> Yes, what I’m saying is that it already hashes just the values of the struct so overriding the hash method won’t fix it ⏎ ⏎ You need to control the `Hasher` so it doesn’t randomize the hashing seed if that’s really what you want to do https://github.com/crystal-lang/crystal/blob/c9d1eef8fde5c7a03a029d64c8483ed7b4f2fe86/src/crystal/hasher.cr#L85
<FromGitter> <vladfaust> Uh-uh, gonna ask Funny Falcon directly in our chat
<FromGitter> <matthewmcgarvey> Looks like you would actually just overwrite this method on object and provider your own hasher https://github.com/crystal-lang/crystal/blob/c9d1eef8fde5c7a03a029d64c8483ed7b4f2fe86/src/object.cr#L86
<FromGitter> <vladfaust> Don't want to monkey-patch the whole program =(
<FromGitter> <vladfaust> Thanks, guys
<FromGitter> <vladfaust> I guess the best variant would be to stick with "inspect". Raw inspect gives 10M IPS, which is enough. But what are the fastest ways to hash an IO then? SHA1 leads to 10M -> 1M
laaron has quit [Remote host closed the connection]
<FromGitter> <vladfaust> Again, I don't need crypto security
laaron has joined #crystal-lang
<FromGitter> <vladfaust> https://github.com/kuende/murmur3 gives 10M -> 4M, which is better
<FromGitter> <matthewmcgarvey> Maybe try https://github.com/jreinert/xxhash-crystal?
<FromGitter> <vladfaust> These are bindings, would require explicit installation of xxhash C
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <elorest> Is there anyone here in the Crystal Community who would be interested in coming to work on existing crystal projects at Nikola Motor Company. Phoenix AZ. Not currently remote, which is unfortunate but I moved to Phoenix for it and it's pretty nice here.
<Yxhuvud> Phoenix is a bit far away..
<FromGitter> <vladfaust> If the company paid for relocation, I'd be interested
<FromGitter> <Blacksmoke16> is crystal nightly still broken on travis?
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/CrSerializer/blob/expansion/docs/serialization.md#expansion `CrSerializer` also supports YAML now
<FromGitter> <Blacksmoke16> plus added new expansion feature
<FromGitter> <vladfaust> @Blacksmoke16 nope, nightly build nicely
<FromGitter> <Blacksmoke16> 💯 nice
<FromGitter> <vladfaust> TIL `2 ** 64 = 0` in Crystal
<FromGitter> <Blacksmoke16> prob overflows
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/61nd
<FromGitter> <vladfaust> Still weird
<oprypin> overflow error checking is coming tho
<FromGitter> <vladfaust> And what would be `2 ** 64` result then?
<oprypin> overflow error
<FromGitter> <vladfaust> Runtime, @oprypin?
<oprypin> runtime
<FromGitter> <vladfaust> Alright. I guess it's good
<oprypin> CPU has overflow check built in so dont worry about performance either
<FromGitter> <vladfaust> Awesome!
<FromGitter> <elorest> @vladfaust Nikola will pay for relocation within the country. I'm not sure about Moscow though.
<FromGitter> <vladfaust> @elorest I would be happy if you asked about that. My contacts are always at vladfaust.com
<FromGitter> <elorest> @vladfaust Sounds good. I'll bring that up.
<FromGitter> <vladfaust> Thank you
<FromGitter> <greenbigfrog> Huh? Can't I do `DB.mapping(sth: Data::TransactionMemo`? `can't cast Nil to Data::TransactionMemo` ⏎ ⏎ ```enum Data::TransactionMemo ⏎ FIRST ⏎ SECOND ⏎ ETC ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5c438e7ff780a1521f389349]
<oprypin> greenbigfrog, i'm sure the error is not in this piece of code...
<FromGitter> <vladfaust> You're passing a nilable value to `DB.mapping`
<FromGitter> <greenbigfrog> But how? I'm only calling a query_one?
<FromGitter> <greenbigfrog> If I change it to `TransactionMemo?` I'll get `undefined constant TransactionMemo` ⏎ And If I then change it to `Data::TransactionMemo?` I'll get `PG::ResultSet#read returned a Slice(UInt8). A (Data::TransactionMemo | Nil) was expected. ⏎ `
<oprypin> what..
<oprypin> really though, http://sscce.org/
<oprypin> mm this website is even better than i remember
<FromGitter> <greenbigfrog> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4392bd1cb70a372a0629b8]
<FromGitter> <greenbigfrog> shouldn't this work?
<FromGitter> <Blacksmoke16> would depend on if the adapter can convert the string enum values from db to instance of the enum crystal type
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/CrSerializer/releases/tag/v0.6.0 new version is out, enjoy
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Quit: Saliendo]
bmcginty has quit [Ping timeout: 252 seconds]
<FromGitter> <girng> i think i'm cracking the code of a programmer and how confidence can play a vital role in development
<FromGitter> <girng> YOU MUST believe in yourself and feel confident in what you are coding. this makes you not re-compile your code every other 2 seconds just to make sure you wrote a correct variable. this let's you write more and saves a lot of time. i used to just write like 2 lines of code, and then re-compile just to check to make sure. but now, it's 4, 6, sometimes 8 lines instead. i am feeling more confident
<FromGitter> <Blacksmoke16> indeed
<FromGitter> <Blacksmoke16> 🚀 good to hear
<FromGitter> <girng> 🚀 !
<FromGitter> <Blacksmoke16> ayy, check it out
<FromGitter> <Blacksmoke16> just gotta write tests
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c43b1608ce4bb25b8db5178]
<FromGitter> <girng> O_o
<FromGitter> <Blacksmoke16> :p
bmcginty has joined #crystal-lang