<FromGitter>
<Blacksmoke16> but probably very brittle
<FromGitter>
<Blacksmoke16> `SELECT t0."id" AS c1, t0."name" AS c2, t0."alive" AS c3, t5."id" AS c4, t5."color" AS c6, t5."user_id" AS c7 FROM "users" t0 LEFT JOIN "settings" t5 ON t5."user_id" = t0."id" WHERE t0."id" = $1` if you were wondering, yes you can have one obj consume a result set, then pass that on to another, assuming columns are selected in correct order
zorp has quit [Ping timeout: 264 seconds]
alexherbo2 has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<guglielmocg_gitlab> Hello everyone, first post on the crystal board. ⏎ In Ruby I can use YAML.load to interpret a correctly formatted string as a hash. I would like to know if Crystal has such a functionality where it can turn a string like "{key: value}" into an object {"key": "value"}
<FromGitter>
<naqvis> @guglielmocg_gitlab Welcome. Are you asking to load YAML to `Hash`?
<FromGitter>
<scriptmaster> I had to do `brew reinstall openssl` and then `export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"`
<FromGitter>
<asterite> postmodern: there's only one type of enum in Crystal, there's no such thing as a "C enum" and "Crystal enum" (there used to be a difference but not anymore). For LLVM we use enums, and these are declared outside of the "lib" namespace because they are user-facing too
zorp has quit [Ping timeout: 256 seconds]
<FromGitter>
<throwaway4rust> I am trying to run some crystal project and I constantly get random "failed to update" when I do shards install
<FromGitter>
<throwaway4rust> by random I mean it fetches different pkgs and the pkgs fail randomly
<FromGitter>
<Blacksmoke16> can you share the error?
<FromGitter>
<scriptmaster> the command is called shards (crystal shards of a gem) and the file is called shard.lock and shard.yml - shard install would have been better or shards.yml and shards.lock would have been way better..
<FromGitter>
<scriptmaster> and there isn't a shards add ? I had to put that in the .yml everytime..
<FromGitter>
<Blacksmoke16> not atm, was an issue/pr about it iirc
<FromGitter>
<Blacksmoke16> @throwaway4rust thats a compile error
<FromGitter>
<throwaway4rust> seems so
<FromGitter>
<Blacksmoke16> is it a postinstall step?
<FromGitter>
<Blacksmoke16> yea i dunno, prob best to drop into the lucky gitter
<FromGitter>
<Blacksmoke16> or tell the guy on reddit
<FromGitter>
<throwaway4rust> ill try higher version of dexter
<FromGitter>
<throwaway4rust> i cant see it has been reported already
<FromGitter>
<throwaway4rust> i can*
<FromGitter>
<Blacksmoke16> 👍 could have been he was working with a locked version that didnt support `0.35.x`
<FromGitter>
<Blacksmoke16> maybe try an update
Dreamer3 has joined #crystal-lang
<FromGitter>
<throwaway4rust> Does having a powerful Ryzen or Threadripper actually help with compile speeds for LLVM languages like Crystal and Rust?
<FromGitter>
<Blacksmoke16> crystal is single threaded when compiling so prob not
<FromGitter>
<j8r> Single core is the most important yes
<FromGitter>
<throwaway4rust> Ah so the compiler would have to be parallelized
<FromGitter>
<throwaway4rust> and that's probably pretty hard to do right?
<FromGitter>
<Blacksmoke16> probably yea
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
zorp has joined #crystal-lang
<FromGitter>
<asterite> the codegen (LLVM) phase is done in parallel in a bunch of threads, so the answer is yes (for that part)
<FromGitter>
<j8r> Is there any better way to know what Integer type an Enum has? https://carc.in/#/r/9hte
<FromGitter>
<Blacksmoke16> prob define some class method on it?
<FromGitter>
<wontruefree> this is a crazy question but I am looking for a blog post that I thought was on crystal-lang.org. It was about named parameters and there was an example of positional and named arguments and how crystal handles them
<FromGitter>
<Blacksmoke16> wasnt that part of a talk ary gave
<FromGitter>
<wontruefree> it might have been
<FromGitter>
<wontruefree> hmmm I thought I might know what talk but I dont see it
<FromGitter>
<j8r> I think I will not deal with unions at all
<FromGitter>
<j8r> overall a protocol has to have clearly, unambiguously typed fields
<raz>
hmm, shouldn't nil be its own type then?
<raz>
making it an empty string feels weird to me (but no idea if it'd make a difference for anything relevant)
<FromGitter>
<j8r> empty string sounds logical.
<raz>
how do you serialize? <type><size><body>?
<FromGitter>
<j8r> the idea is to have an annotation for the String/Bytes size
<FromGitter>
<j8r> serializing iterates over each ivar of an object, in the order
<oprypin>
what's an efficient way to iterate over a Hash in sorted order
<oprypin>
surely not .to_a.sort!.each
<FromGitter>
<Blacksmoke16> sorted in which way? hash is sorted based on insert order
<oprypin>
oh excuse me `.to_a.sort_by!(&.[0]).each`
<FromGitter>
<j8r> probably sorting keys
<oprypin>
i'd prefer to sort the hash itself once, of course
<raz>
j8r: hmm. not sure about that particular case. but i think it might be worth taking a peek at protobuf (and perhaps the ser-formats of other languages) for general inspiration. lots of prior art out there, and
<FromGitter>
<j8r> (through `IO#write` and `IO#read`
<oprypin>
thts nice
<raz>
yap i think that prob makes sense.
<raz>
maybe it could be even faster if it had direct compiler support, but that's beyond my knowledge horizon
<raz>
(but the format would prob be the same anyway)
<FromGitter>
<j8r> if the field is 3 and the string is `"a"`, the bytes would be `Bytes[97, 0, 0]` - logic. I don't see any other way to do. So an empty string will be `Bytes[0, 0, 0]`
<FromGitter>
<j8r> AFAIK msgpack and protobuf don't really support unions
<oprypin>
j8r, no msgpack has to, json is union-like
<FromGitter>
<j8r> thanks for the reference, i will dig into it to take some inspiration
<oprypin>
j8r, shouldnt it be a different library then
<oprypin>
if one part of your lib specifies field names and types and another one requires them
<oprypin>
actually.. do you support serializing arbirary structures like json does or not?
<oprypin>
i mean stdlib's json serializable
DTZUZU has joined #crystal-lang
zorp has quit [Ping timeout: 240 seconds]
<FromGitter>
<j8r> not arbitrary, the schema need to be known both by the client and server
DTZUZU_ has quit [Ping timeout: 256 seconds]
<FromGitter>
<j8r> really just the stdlib is used. For instance, if an object has `@ivar = 1` and `@other = 12.4`, an IO::Memory will be created (from your advice), @ivar will be converter to bytes with `io.write_bytes @ivar`, same for @other.
<FromGitter>
<j8r> I just had few thing like filling with `0` too short strings, to fit the field size, things like that
duane has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]
f1refly has quit [*.net *.split]
baweaver has quit [*.net *.split]
Welog has quit [*.net *.split]
olbat has quit [*.net *.split]
davic has quit [*.net *.split]
baweaver has joined #crystal-lang
f1refly has joined #crystal-lang
davic has joined #crystal-lang
Welog has joined #crystal-lang
olbat has joined #crystal-lang
HumanG33k has quit [Ping timeout: 265 seconds]
zorp has joined #crystal-lang
<oprypin>
what was the shorthand for a question-mark property
<FromGitter>
<Blacksmoke16> `getter?`?
<FromGitter>
<Blacksmoke16> or `property?`
<oprypin>
i want `foo.bar? ||= x` to do `foo.bar? || (foo.bar = x)`