<FromGitter>
<mixflame> warning, it tries to connect you to a video call
DTZUZU_ has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 260 seconds]
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 260 seconds]
<FromGitter>
<caspiano> i'm trying to use the compiler directly in one of my projects (I need to traverse the requires of a crystal entrypoint), I'm also doing this in an alpine environment. ⏎ ⏎ the main thing that's blocking me is the missing `llvm_ext.o` object, which i see is dropped in the Dockerfile for alpine ⏎ ⏎ would i be better off trying to do this in the ubuntu container (doesn't look like `llvm_ext.o` is
<FromGitter>
<tenebrousedge> no, but you can capture blocks and use `yield` instead
<FromGitter>
<Dan-Do> yeah, let me try to re-write the code
<FromGitter>
<tenebrousedge> `String|Int32|Bool` seems awkward to deal with
<naqvis>
most of the times I just wonder, how dynamic languages have spoiled its user at the ease of development
<FromGitter>
<tenebrousedge> well, I don't know about spoiling, but Crystal lends itself well to the use of structs instead of catch-all data structures, just because of the type system
<FromGitter>
<tenebrousedge> I usually tend to view this as a good thing, particularly with how easy it is to define structs and aliases
<naqvis>
yeah, i was trying to made my point for dynamic languages without any type system and put anything in any data structure approach
<naqvis>
and that's what i was referring to as "spoil its users"
<FromGitter>
<Blacksmoke16> i feel like there has to be a better way to do this...
<FromGitter>
<Dan-Do> atm, I use above code. Just want know if there is any better design
<FromGitter>
<Blacksmoke16> are there a set amount of transformations? Or are they totally arbitrary
<FromGitter>
<tenebrousedge> also can we do `Foo.new {|bar, baz| bar.transform } ` ?
<FromGitter>
<Blacksmoke16> it would also help to know what this data is and how its used
<FromGitter>
<Dan-Do> arbitrary, some time `web_data["error_message"]` as String, some time `web_data["amount"]` as Int, some time `data["user"]` as Hash...
<FromGitter>
<Blacksmoke16> is this some sort of homegrown templating engine or something?
<FromGitter>
<Dan-Do> You're correct :)
<FromGitter>
<Blacksmoke16> solution here is just dont do that and use something better :)
<FromGitter>
<naqvis> @Dan-Do also out of context to your current question, but line `if user = data["user"]` should be written as `if user = data["user"]?`
<FromGitter>
<naqvis> since the data you are passing is unstructured (or you don't know the exact structure) of data, it make more sense to pass your data as json or string and then do the parsing in transformation
<FromGitter>
<naqvis> because for unstructured data, you can't define a structure with known fields
<FromGitter>
<Blacksmoke16> how do you have it setup then? normally a SPA is using js to change/manage the view and stuff. If you have crystal doing that it would be server rendered HTMl and not really an SPA anymore
<FromGitter>
<Dan-Do> the crystal will render page when js is disabled
<FromGitter>
<Blacksmoke16> i remember talking about this a while ago
<FromGitter>
<Dan-Do> :)
<FromGitter>
<Blacksmoke16> sounds neat but really complex
<FromGitter>
<Dan-Do> I have a work around then, but want to find if I can use pro literal
<FromGitter>
<naqvis> also better to use alias to represent your proc type ⏎ `alias RenderProc = Proc(String, JSON::Any, Hash(String, String))`
<FromGitter>
<naqvis> this will save you some typing
<FromGitter>
<tenebrousedge> and one for the `Hash(String, String)` too
<FromGitter>
<tenebrousedge> aliases ftw
<FromGitter>
<Dan-Do> thanks guys for the help
<FromGitter>
<Dan-Do> 👍
<FromGitter>
<tenebrousedge> I'm also fond of using (e.g.) `alias Label = String`. Any time I can be more specific about what things are, the easier time I'm going to have modifying that code in the future
<FromGitter>
<elorest> <jhass> that scalar thing was exactly what I was missing. Thanks a lot.
Seich has quit [Quit: Gone fishing.]
maxpowa has quit [Ping timeout: 260 seconds]
maxpowa has joined #crystal-lang
<FromGitter>
<jrei:matrix.org> hum too bad
<FromGitter>
<jrei:matrix.org> the automated crystal installation script takes my system, Debian 11 unstable, as Debian_11 instead of Debian_Unstable
<FromGitter>
<jrei:matrix.org> I doubt it can be easily solved...
<FromGitter>
<jrei:matrix.org> I don't think it makes sense to have Debian_Testing, because testing is the next stable - here Debian 11
<FromGitter>
<HertzDevil> `user.is_a?(Hash)` will always fail since `user` is a `JSON::Any`
<FromGitter>
<HertzDevil> do something like `if user_h = user.as_h?` instead, if you must
<FromGitter>
<HertzDevil> also it looks like you could use `use_json_discriminator`