ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.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
absolutejam1 has quit [Ping timeout: 258 seconds]
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
<FromGitter> <HCLarsen> And the error rears its ugly head again.
<FromGitter> <Blacksmoke16> 😧
<FromGitter> <HCLarsen> It has something to do with a missing key in a NamedTuple.
<FromGitter> <HCLarsen> Sorry, Hash, not NamedTuple
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 245 seconds]
Groogy has quit [Read error: Connection reset by peer]
DTZUZO has quit [Ping timeout: 246 seconds]
<FromGitter> <tenebrousedge> maybe set a sane default on the Hash? or at least a non-segfaulty error?
<FromGitter> <watzon> Idk how a missing key would cause a segfault though. Any segfault is a bug.
* FromGitter * tenebrousedge shrugs
chemist69 has quit [Ping timeout: 264 seconds]
chemist69 has joined #crystal-lang
DTZUZO has joined #crystal-lang
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 245 seconds]
absolutejam1 has joined #crystal-lang
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 245 seconds]
absolutejam1 has quit [Ping timeout: 264 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 246 seconds]
absolutejam1 has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 258 seconds]
absolutejam1 has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 276 seconds]
absolutejam1 has joined #crystal-lang
fyber has quit [Ping timeout: 245 seconds]
fyber has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
gangstacat has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 245 seconds]
absolutejam1 has joined #crystal-lang
absolutejam1 has quit [Read error: Connection reset by peer]
absolutejam1 has joined #crystal-lang
flaviodesousa has joined #crystal-lang
<FromGitter> <didactic-drunk> How do you build with preview_mt?
flaviodesousa has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
<FromGitter> <Blacksmoke16> think you can do like `make FLAGS="-D preview_mt"`
duane has joined #crystal-lang
<FromGitter> <gdotdesign> just append `-D preview_mt` to the command
<FromGitter> <Blacksmoke16> oh yea sorry, the other thing is if you want to build the compiler with MT
ht_ has joined #crystal-lang
Nekka has quit [Quit: zzz]
Nekka has joined #crystal-lang
DTZUZO has joined #crystal-lang
Nekka has quit [Client Quit]
Nekka has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 276 seconds]
duane has quit [Ping timeout: 258 seconds]
absolutejam1 has joined #crystal-lang
duane has joined #crystal-lang
sagax has quit [Ping timeout: 245 seconds]
<FromGitter> <Daniel-Worrall> I've got ⏎ ⏎ ```{% for foo in FOO %} ⏎ p "{{foo.id}}" ⏎ {% end %}``` [https://gitter.im/crystal-lang/crystal?at=5d6fd1df75940034a264682b]
<FromGitter> <Daniel-Worrall> uh, `FOO = [FOO/BAR]` this too ⏎ It ends up with whitespace between it all so `"FOO / BAR"`
<FromGitter> <Daniel-Worrall> What *should* I be doing
<FromGitter> <Blacksmoke16> can you make a playground link?
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/7hmf
<FromGitter> <Daniel-Worrall> Macros confuse me
<FromGitter> <Blacksmoke16> correct me if im wrong, but shouldnt the constant be like `FOO = ["Foo/Bar"]`?
<FromGitter> <Daniel-Worrall> There we go
absolutejam1 has quit [Ping timeout: 264 seconds]
<FromGitter> <Blacksmoke16> πŸ‘
lawrence[m] has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanGeek has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> /cc @watzon https://github.com/crystal-lang/crystal/issues/8148
<FromGitter> <didactic-drunk> You can build programs with mt without having mt compiled in the compiler?
<FromGitter> <Blacksmoke16> i guess?
<FromGitter> <Blacksmoke16> @j8r https://play.crystal-lang.org/#/r/7hro a bit more complete example
duane has quit [Ping timeout: 244 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
melthelesbian has quit [Ping timeout: 244 seconds]
melthelesbian has joined #crystal-lang
absolutejam1 has joined #crystal-lang
duane has joined #crystal-lang
sagax has joined #crystal-lang
duane has quit [Ping timeout: 244 seconds]
<FromGitter> <j8r> @Blacksmoke16 I don't know why intermediate objects are created
ht_ has quit [Remote host closed the connection]
<FromGitter> <j8r> The user won't use them, that's an internal API right?
<FromGitter> <j8r> nvm they can be used by the user
<FromGitter> <j8r> I am not sure of the point to have a dynamic mapping
<FromGitter> <j8r> i.e. `SerializationContext`
<FromGitter> <j8r> It will be more efficient to set everything at compile time. One can create another object if needed
<FromGitter> <Blacksmoke16> but some things cannot be set at compile time
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d703584c3071d549c6a9481]
<FromGitter> <Blacksmoke16> like that for example
<FromGitter> <Blacksmoke16> > It will be more efficient to set everything at compile time. One can create another object if needed ⏎ ⏎ This would be gross if you had to have separate objects just to do what that does
<FromGitter> <Blacksmoke16> @j8r ^
<FromGitter> <Blacksmoke16> IMO the extra flexibility you get is much more helpful than having it be faster in benchmarks
<FromGitter> <j8r> It make sense to have 2 separate objects
<FromGitter> <Blacksmoke16> why?
<FromGitter> <j8r> I looked at Serde, AFAIK they haven't this feature
<FromGitter> <Blacksmoke16> so?
<FromGitter> <j8r> because the mapping are different, even they look close
<FromGitter> <Blacksmoke16> just because serde doesnt have it doesnt mean its the end of the world
<FromGitter> <Blacksmoke16> its literally the same object, you're just altering how it gets serialized at runtime
<FromGitter> <j8r> I didn't see in other places too, like Go
<FromGitter> <watzon> Nothing wrong with *cue macintosh boot sound* thinking differently
<FromGitter> <j8r> There are perf impact and more complexity for a niche feature IMHO
<FromGitter> <j8r> What is the problem of 2 objects? We can use inheritance and composition already
<FromGitter> <Blacksmoke16> E.x an ORM model
<FromGitter> <Blacksmoke16> im totally against having "view" objectss
<FromGitter> <Blacksmoke16> if you can get the same result from one object with some annotations
<FromGitter> <Blacksmoke16> sure its going to be a bit slower, but that extra flexibility is much more useful to me imo
<FromGitter> <Blacksmoke16> than being a bit higher in a benchmark
<FromGitter> <j8r> In you example,we can have `Example1` and `Example2` inheriting from another object
<FromGitter> <Blacksmoke16> i.e. like define id/title on parent, and each unique property in its own class?
<FromGitter> <Blacksmoke16> that still wouldnt work, they all share the same properties, you just need to alter how it gets serialized
<FromGitter> <Blacksmoke16> to do that currently you would have to do something yourself, or have "view" objects
<FromGitter> <j8r> Sorry I'm probably missing something
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ is another example [https://gitter.im/crystal-lang/crystal?at=5d703a726d7c672b45b5cefa]
<FromGitter> <Blacksmoke16> that also uses the context
<FromGitter> <Blacksmoke16> the other benefit is the user can define their own strategies on what properties should be excluded
<FromGitter> <Blacksmoke16> like the one i had in the playground link, but ofc could be more useful
<FromGitter> <j8r> I see now
<FromGitter> <Blacksmoke16> e.x. `@[IgnoreOnUpdate]` which could ignore deserializing a property on PUT, but allow it to be set on POST
<FromGitter> <Blacksmoke16> or some ACL thing
<FromGitter> <Blacksmoke16> based on current user
<FromGitter> <j8r> annotations sounds like out of place then, if what your want is defining constraints at runtime
<FromGitter> <Blacksmoke16> also included in the playground link
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d703bcb75940034a2676f1f]
<FromGitter> <Blacksmoke16> dosn't *have* to use annotations
<FromGitter> <Blacksmoke16> but just showing its possible
<FromGitter> <Blacksmoke16> like `SomeExclusionStrategy` is added at runtime, but only if at least 1 ivar on `self` has the annotation
<FromGitter> <Blacksmoke16> like you can do it however you want
<FromGitter> <Blacksmoke16> but yea, working with annotations is a bit harder since we dont have reflection, so im currently just storing an array of applied annotations within the metadata struct
absolutejam1 has quit [Ping timeout: 264 seconds]
<FromGitter> <j8r> The idea is good, but it will even better if it's an extension of the framework
<FromGitter> <j8r> Like CrSerializer, in some way
<FromGitter> <j8r> I'm not convinced everyone will need it every time, I don't know the perf/memory penalty.
<FromGitter> <Blacksmoke16> @j8r thats idea, the shard defines the structure and common stuff, then users can extend it as needed
<FromGitter> <dscottboggs_gitlab> why is there no way to iterate over the child-nodes of an ASTNode in macros?
<FromGitter> <Blacksmoke16> like children of a parent class or?
<FromGitter> <dscottboggs_gitlab> like `{{@def.body.children.each}}` or something
<FromGitter> <dscottboggs_gitlab> which would give you like an array of ASTNodes which might be like Calls or Vars or whatever
<FromGitter> <dscottboggs_gitlab> woke up this morning thinking for sure I could implement Go's `defer` by using just macros, just wound up crashing the compiler a bunch of times because the type given to `@def.body` is basically useful only for string manipulation and stuff
<FromGitter> <Blacksmoke16> and yea @j8r, its def slower but i doubt it would be noticeable in a real world scenario. prob could see it in benchmarks but meh
<FromGitter> <Blacksmoke16> boils down to just a few extra method calls and some loops
<FromGitter> <Blacksmoke16> @dscottboggs_gitlab whats that do?
<FromGitter> <dscottboggs_gitlab> what's what do? Go's `defer` or `@def.body`?
<FromGitter> <Blacksmoke16> nvm https://tour.golang.org/flowcontrol/12
<FromGitter> <dscottboggs_gitlab> ye it's pretty simple
<FromGitter> <dscottboggs_gitlab> it would be pretty easy to implement if you could iterate over the ast nodes in a `Def`'s body...
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <watzon> @dscottboggs_gitlab you can in Nim :/
<FromGitter> <watzon> I wish you could in crystal
<FromGitter> <dscottboggs_gitlab> guess I need to learn nim now so I can rip off their implementation for crystal\
<FromGitter> <dscottboggs_gitlab> :/
<FromGitter> <watzon> Well what nim has is a more advanced macro system
<FromGitter> <watzon> In nim you'd be able to loop over the ast of a method definition and change it at compile time
<FromGitter> <dscottboggs_gitlab> > Nim has is a more advanced macro system ⏎ ⏎ In like a fundamental, architectural way, or like, it's just more fleshed out?
<FromGitter> <dscottboggs_gitlab> That's exactly what I want to be able to do
<FromGitter> <Blacksmoke16> maybe one day
<FromGitter> <watzon> One could hope, but the maintainers don't seem to be interested