ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
Chillfox has joined #crystal-lang
ur5us has quit [Ping timeout: 264 seconds]
ur5us has joined #crystal-lang
<FromGitter> <nanobowers> per an earlier question from postmodern regarding: ⏎ ⏎ > ah ha, you defined default using a generic type T (but i think you forgot to define Option as Option(T) ?) ⏎ ⏎ The problem I eventually ran into was that I am capturing an Hash of String=>Option (where Option is an abstract class, so really any stored hash values would be subclasses of Option), but by defining Option as templated class, I
<FromGitter> <nanobowers> unsure how to work around this. The `@specs` ivar could be taking any variety of subclasses of Option (e.g. StringOpt, Int32Opt, ... FileOpt, etc.)
<FromGitter> <Blacksmoke16> define another superclass of `Option` that isnt generic
<FromGitter> <Blacksmoke16> and use that to type the hash
<FromGitter> <nanobowers> ok thx, will give that a shot.
<FromGitter> <nanobowers> I'm now getting: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ BoolOpt is defined as: `class BoolOpt < Option(Bool)` ... [https://gitter.im/crystal-lang/crystal?at=616638ae2197144e8460e67b]
<FromGitter> <Blacksmoke16> is `BaseOption` abstract?
<FromGitter> <nanobowers> yes
<FromGitter> <Blacksmoke16> could try switching to a module, or to like `abstract def name : String` in `BaseOption`
<FromGitter> <mwlang> My google-fu fails me. I'm looking for how to define a Union constant so I can reuse throughout my library? ⏎ ⏎ ```ListenerChannel = Channel(ChannelMessage | ChannelClose | ChannelError)``` [https://gitter.im/crystal-lang/crystal?at=61663a8138377967f44bc271]
<FromGitter> <Blacksmoke16> you want `alias` not a constant
<FromGitter> <Blacksmoke16> `alias ListenerChannel = ...`
<FromGitter> <mwlang> ah!
<FromGitter> <mwlang> thank you
<FromGitter> <nanobowers> trying `abstract def name : String ` in `BaseOption` was unsuccessful. If I remove `def name..` from `Option(T)`, then I get this (an expected error): ⏎ ⏎ ```Error: abstract `def Optimist::BaseOption#name()` must be implemented by Optimist::BoolOpt``` ⏎ ⏎ but if i define `def name...` on `Option(T)`, then back to the no overload matches on `Optimist::BoolOpt#name`
<FromGitter> <Blacksmoke16> try removing the type restriction of `: String`
<FromGitter> <mwlang> I don't suppose Crystal has the equivalent to Ruby's Array#wrap -- just scanned through the Array class docs and didn't see anything like it.
<FromGitter> <Blacksmoke16> not built i nno
<FromGitter> <Blacksmoke16> looks fairly easy to implement tho
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter> <mwlang> it was -- mostly just avoiding reinventing wheels where possible.
<FromGitter> <mwlang> Trying to set up a Hash that can auto add new keys when missing. I'm not quite getting the block defined right: ``` ⏎ Hash(String, Binance::Handler).new({ |symbol| handler_class.new(symbol) }) ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=61664695a41fd20699dde4ee]
<FromGitter> <mwlang> gives me `Error: unterminated call`
<FromGitter> <Blacksmoke16> Hash docs have an example of the exact syntax
<FromGitter> <Blacksmoke16> But you don't pass a block as the value to the constructor
<FromGitter> <mwlang> I'm looking at the docs...it's just dense to my Ruby-wired brain. :-p
<FromGitter> <mwlang> oh! found more info further down.
<FromGitter> <mwlang> it worked! wow. The refactor I just did cleared a bunch of conditionals out of my code base.
<FromGitter> <Blacksmoke16> Nice!
<FromGitter> <mwlang> really loving Crystal's Fibers + Channels choice -- that took some getting used to, but every time I work with 'em, I get a little bit better at it.
<FromGitter> <mwlang> one thing I learned, it's far too easy to clobber a Redis datastore if you have one fiber writing keys while another's reading. I didn't seem to run into that at all with Ruby
<FromGitter> <mwlang> I reckon I need to throw some mutex.synchronize around those read/write operations.
<FromGitter> <Blacksmoke16> if you're running in single threaded mode only one would be executing anyway
<FromGitter> <Blacksmoke16> afaik mutex is only needed with MT mode to prevent more than 1 fiber from accessing a shared resource
deavmi has quit [Ping timeout: 252 seconds]
ur5us has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi_ has joined #crystal-lang
Guest70931 has quit [Ping timeout: 268 seconds]
_whitelogger has quit [Ping timeout: 268 seconds]
wolfshappen_ has quit [Ping timeout: 260 seconds]
_whitelogger_ has joined #crystal-lang
void09_ has quit [*.net *.split]
adam12 has quit [*.net *.split]
r0bby has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
Vexatos has quit [*.net *.split]
Stephie has quit [*.net *.split]
Starfoxxes has quit [*.net *.split]
Chillfox has quit [*.net *.split]
notzmv has quit [*.net *.split]
greenbigfrog has quit [*.net *.split]
avane has quit [*.net *.split]
FromGitter has quit [*.net *.split]
DeBot_ has quit [*.net *.split]
jhass has quit [*.net *.split]
Elouin has quit [*.net *.split]
straight-shoota has quit [*.net *.split]
maxpowa has quit [*.net *.split]
Peter0x44 has quit [*.net *.split]
Liothen has quit [*.net *.split]
pixel has quit [*.net *.split]
xybre has quit [*.net *.split]
repo has quit [*.net *.split]
hexology has quit [*.net *.split]
[R] has quit [*.net *.split]
ulyssa has quit [*.net *.split]
cfebs has quit [*.net *.split]
markmarkmark has quit [*.net *.split]
Guest70931 has quit [*.net *.split]
yxhuvud has quit [*.net *.split]
fifr_ has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
_whitelogger has quit [*.net *.split]
repo[m] has quit [*.net *.split]
brw has quit [*.net *.split]
sorcus has quit [*.net *.split]
antoszka has quit [*.net *.split]
mikko has quit [*.net *.split]
raz has quit [*.net *.split]
deavmi_ has quit [*.net *.split]
oz has quit [*.net *.split]
riza has quit [*.net *.split]
f1refly has quit [*.net *.split]
olbat[m] has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
pusewic|away has quit [*.net *.split]
lanodan has quit [*.net *.split]
olbat has quit [*.net *.split]
dom96_ has quit [*.net *.split]
SamantazFox has quit [*.net *.split]
fifr[m] has quit [*.net *.split]
jhass[m] has quit [*.net *.split]
oprypin has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
sagax has quit [*.net *.split]
_whitelogger has joined #crystal-lang
Chillfox has quit [Quit: Leaving]
pusewic|away_ has joined #crystal-lang
Elouin has quit [*.net *.split]
straight-shoota has quit [*.net *.split]
maxpowa has quit [*.net *.split]
Peter0x44 has quit [*.net *.split]
Liothen has quit [*.net *.split]
pixel has quit [*.net *.split]
xybre has quit [*.net *.split]
repo has quit [*.net *.split]
hexology has quit [*.net *.split]
[R] has quit [*.net *.split]
ulyssa has quit [*.net *.split]
cfebs has quit [*.net *.split]
markmarkmark has quit [*.net *.split]
repo[m] has quit [*.net *.split]
brw has quit [*.net *.split]
sorcus has quit [*.net *.split]
antoszka has quit [*.net *.split]
mikko has quit [*.net *.split]
raz has quit [*.net *.split]
deavmi_ has quit [*.net *.split]
riza has quit [*.net *.split]
f1refly has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
pusewic|away has quit [*.net *.split]
olbat[m] has quit [*.net *.split]
lanodan has quit [*.net *.split]
olbat has quit [*.net *.split]
Flipez has quit [*.net *.split]
wolfshappen has quit [*.net *.split]
mattt2 has quit [*.net *.split]
mookie has quit [*.net *.split]
adam12 has quit [*.net *.split]
r0bby has quit [*.net *.split]
void09_ has quit [*.net *.split]
ur5us has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
Vexatos has quit [*.net *.split]
Stephie has quit [*.net *.split]
Starfoxxes has quit [*.net *.split]
notzmv has quit [*.net *.split]
avane has quit [*.net *.split]
greenbigfrog has quit [*.net *.split]
jhass has quit [*.net *.split]
DeBot_ has quit [*.net *.split]
FromGitter has quit [*.net *.split]
wmoxam_ has quit [*.net *.split]
fifr has quit [*.net *.split]
kiwiroy has quit [*.net *.split]
dom96_ has quit [*.net *.split]
jrayhawk_ has quit [*.net *.split]
SamantazFox has quit [*.net *.split]
fifr[m] has quit [*.net *.split]
sagax has quit [*.net *.split]
oprypin has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
jhass[m] has quit [*.net *.split]
xybre has joined #crystal-lang
HumanG33k has joined #crystal-lang
taupiqueur has joined #crystal-lang
notzmv has joined #crystal-lang
jhass[m] has joined #crystal-lang
repo[m] has joined #crystal-lang
olbat[m] has joined #crystal-lang
fifr[m] has joined #crystal-lang
taupiqueur_ has joined #crystal-lang
taupiqueur has quit [Ping timeout: 265 seconds]
jrayhawk has joined #crystal-lang
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 252 seconds]
deavmi has joined #crystal-lang
mookie has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
hightower2 has joined #crystal-lang
<hightower2> ! 1.2.0 ! :)
hightower2 has quit [Ping timeout: 264 seconds]
mattt2 has joined #crystal-lang
<FromGitter> <jwaldrip:matrix.org> is that out!?
<FromGitter> <jwaldrip:matrix.org> Does it support M1? :-)
<FromGitter> <jwaldrip:matrix.org> (not from source)
ur5us has joined #crystal-lang
mookie has quit [Read error: Connection reset by peer]
mookie has joined #crystal-lang
<FromGitter> <y8> Yay, 1.2.0! ⏎ ⏎ I might regret this, but I've bumped brew formula to 1.2.0 with shards 0.16.0. It still builds without arm64 bottle and I can't build bottle, because `brew install --build-bottle crystal-lang` installs 1.1.0. ⏎ ⏎ So it seems like proper way is to to wait for 1.2.0 formula and then re-try it? Or I can just edit formula locally and then push the bottle? ...
<FromGitter> <y8> Uh, happy bootstrap day :D ⏎ ⏎ brew install fails with `ld: in '/opt/homebrew/opt/llvm@11/lib/libunwind.dylib', building for macOS-x86_64 but attempting to link with file built for macOS-arm64` on m1, since it uses previous build which is x86, so it's building in rosetta. ⏎ ⏎ Bumping `boot#on_mac_os` resource to `darwin-universal` binary fixes that. Dunno if this will fly with homebrew maintaners, but
<FromGitter> ... imo this is an easy way out ... [https://gitter.im/crystal-lang/crystal?at=61676b5cd78911028ad8f725]
ur5us has quit [Ping timeout: 268 seconds]
<FromGitter> <Blacksmoke16> dont one of the core devs usually create that?
<FromGitter> <y8> I'm not sure if they have access to M1's to test it out. And actually contributing is the most fun of the opensource! And as for my terrible mistakes there is always `Request changes` button in PR :D
<FromGitter> <Blacksmoke16> yes but getting involved in the release process can just add more work to them
<FromGitter> <Blacksmoke16> maybe it's not a big deal but :shrug: