jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
zorp_ has quit [Ping timeout: 240 seconds]
<FromGitter> <franciscoadasme> hey, is it possible to know the return type of a given method inside a macro like `method_missing` if the return type is not specified in the method declaration?
<FromGitter> <Blacksmoke16> I doubt it
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 244 seconds]
alexherbo27 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo27 is now known as alexherbo2
alexherbo2 has quit [Remote host closed the connection]
<FromGitter> <jasonm23> Hi there, just started playing with Crystal, (currently in-between jobs was until recently the Head of Engineering at Large Insurance Co. Inc in Singapore.) Love Ruby, really enjoying Crystal, and hope to use it in future teams. ⏎ ⏎ My first question is around `crystal spec` and can I add formatters at the cli?
<FromGitter> <Blacksmoke16> it supports some different ones by default, were you looking for something in specific?
<FromGitter> <jasonm23> Well, I wanted to do VerboseFormatter sometimes and mostly use the default DotFormatter
<FromGitter> <Blacksmoke16> `crystal spec -v`?
<FromGitter> <jasonm23> Oh right...
<FromGitter> <jasonm23> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f4885ca9566774dfe3964b6]
<FromGitter> <Blacksmoke16> `crystal spec -- --help`
<FromGitter> <jasonm23> Is there a better guide than this?
<FromGitter> <jasonm23> Ahhh
<FromGitter> <jasonm23> thank you that'll help a lot
<FromGitter> <Blacksmoke16> np
<FromGitter> <jasonm23> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488609482378093749c5b7]
<FromGitter> <Blacksmoke16> yup
<FromGitter> <jasonm23> :D
<FromGitter> <jasonm23> big help @Blacksmoke16
<FromGitter> <Blacksmoke16> but to answer your question, yes you can but idt its documented at all
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Spec.html#add_formatter(formatter)-class-method
<FromGitter> <Blacksmoke16> like what `formatter` or the method below that should be etc
<FromGitter> <jasonm23> so if I did create a formatter, it wouldn't be accessible from command line (right?)
<FromGitter> <Blacksmoke16> mmm, worst case is you prob use https://crystal-lang.org/api/master/OptionParser.html within your `spec_helper` parse out a given flag, then override the default formatter via https://crystal-lang.org/api/master/Spec.html#override_default_formatter(formatter)-class-method
<FromGitter> <Blacksmoke16> if that flag was given
<FromGitter> <jasonm23> oh ok, that makes sense.
<FromGitter> <Blacksmoke16> related to your custom formatter
<FromGitter> <mtsmmp_gitlab> @Blacksmoke16 hey bro
<FromGitter> <jasonm23> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f4888addfaaed4ef5147db4]
<FromGitter> <jasonm23> like that?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <Blacksmoke16> @mtsmmp_gitlab hi
<FromGitter> <jasonm23> thx
<FromGitter> <Blacksmoke16> granted i didnt try it but that should work
<FromGitter> <jasonm23> sure
<FromGitter> <jasonm23> I'm probably only going to need the built ins. Just nice to have
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <mtsmmp_gitlab> real noob question
<FromGitter> <mtsmmp_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488941a5788a3c29b94190]
<FromGitter> <Blacksmoke16> `def self.load(path : String = DB_FILE)`?
<FromGitter> <Blacksmoke16> then do `File.open(path)`
<FromGitter> <mtsmmp_gitlab> i tried inserting properties
<FromGitter> <Blacksmoke16> hm, any reason not to use like sqlite?
<FromGitter> <jasonm23> @mtsmmp_gitlab all code somewhere public?
<FromGitter> <Blacksmoke16> easiest solution would just be to add arguments to load and save methods with a default of your `DB_FILE`
<FromGitter> <Blacksmoke16> is the structure the same for each file?
<FromGitter> <mtsmmp_gitlab> yes
<FromGitter> <Blacksmoke16> another option would be to use inheritance, then you have a concrete class for each data file
<FromGitter> <Blacksmoke16> third option is similar to the first, but make `save` method also a class method and pass in the `db` instance/filename
<FromGitter> <mtsmmp_gitlab> look
<FromGitter> <mtsmmp_gitlab> i would like to do something like this
<FromGitter> <mtsmmp_gitlab> but doesnt work
<FromGitter> <mtsmmp_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488b1749148b41c97963d0]
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <mtsmmp_gitlab> any way to make this work with this structure?
<FromGitter> <Blacksmoke16> id do something like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488b80a5788a3c29b94711]
<FromGitter> <Blacksmoke16> eh i dont really like that
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488c2089cf2d584b7edde1]
<FromGitter> <Blacksmoke16> i think i like that better
<FromGitter> <mtsmmp_gitlab> it works
<FromGitter> <Blacksmoke16> still is a bit weird IMO to have the data class also manage the state of the object but :shrug:
<FromGitter> <Blacksmoke16> prob not a big deal for what you're doing
<FromGitter> <mtsmmp_gitlab> but i didnt want to have to create another class just for that
<FromGitter> <Blacksmoke16> how many db file are there?
<FromGitter> <mtsmmp_gitlab> > how many db file are there? ⏎ ⏎ its only one tiny file, the reason to pass another file as a parameter is just for testing purposes
<FromGitter> <Blacksmoke16> oh
<FromGitter> <mtsmmp_gitlab> its no big deal
<FromGitter> <mtsmmp_gitlab> the problem is this
<FromGitter> <Blacksmoke16> in that case id prob just use a class property
<FromGitter> <mtsmmp_gitlab> ```private DEFAULT_DB = "db.json"```
<FromGitter> <mtsmmp_gitlab> how to convert this to a property?
<FromGitter> <mtsmmp_gitlab> i couldnt
<FromGitter> <mtsmmp_gitlab> could you fix this part on my first example?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488dfeddc2d041c0d0785a]
<FromGitter> <Blacksmoke16> then like within your `spec_helper` or something you can do `DB.database_name = "other.json"`
<FromGitter> <Blacksmoke16> and `load`/`save` will use that from then on
<FromGitter> <Blacksmoke16> could also do like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f488e5136e6f709fd093033]
<FromGitter> <Blacksmoke16> which would essentially make the class a singleton, so you dont get a new instance of `DB` every time you call `load`, which is prob better given they all would be saving to the same underlying file
<FromGitter> <mtsmmp_gitlab> hm
<FromGitter> <mtsmmp_gitlab> i like it
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <mtsmmp_gitlab> thank you very much buddy
<FromGitter> <mtsmmp_gitlab> always learning new things here :)
<FromGitter> <Blacksmoke16> np, anyway imma get to bed o/
<FromGitter> <mtsmmp_gitlab> good night!
postmodern has quit [Quit: Leaving]
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter> <mixflame> flipflops
<FromGitter> <mixflame> flip the dinero itself
<FromGitter> <mixflame> crystal methamphetamine lang
<FromGitter> <mixflame> type that dont shatter
<FromGitter> <mixflame> ive had shatter
<FromGitter> <mixflame> it hits different
<FromGitter> <mixflame> it would be great if it wasn't called crystal you know
<FromGitter> <mixflame> crystals shatter at a certain frequency, be a bad thing if we were vulernable to that
<FromGitter> <mixflame> and also apples go rotten
<FromGitter> <mixflame> if not moved out in a manner that makes sense it can lead to fake food
<FromGitter> <mixflame> yes but I'm liable to stay for 6 days and fight a pillow
<FromGitter> <mixflame> oh sorry, was talking to myself
<FromGitter> <mixflame> i doing everythng all by myself now you know FUCK IT ILL DO IT MYSELF
<FromGitter> <mixflame> don't worry about me guys
<FromGitter> <mixflame> but i'm worried bout the name of this language
<FromGitter> <mixflame> i feel like it says "the americans won't kick our ass. we're too sneaky"
<FromGitter> <mixflame> when i truely hate sneakiness
<FromGitter> <naqvis> i would say naming is kind of personal preference
<FromGitter> <naqvis> as there are magnitude of languages with weird name but decades of history
<FromGitter> <mixflame> crystal is a name for methamphetamine
<FromGitter> <mixflame> ruby is a rock
<FromGitter> <mixflame> we all hate meth
<FromGitter> <mixflame> here
<FromGitter> <naqvis> :P
<FromGitter> <mixflame> i can could push over a meth addict and kill them
<FromGitter> <mixflame> they need a taser to fight me
<FromGitter> <mixflame> or a skateboard
<FromGitter> <naqvis> but I agree it would be better to have core team post a history/background of why this name was selected
<FromGitter> <mixflame> agreed, thanks
<FromGitter> <naqvis> we won't mind if it has same reasoning has "Hadoop" :P
deavmi has quit [Quit: Eish! Load shedding.]
<FromGitter> <mixflame> hahha
<FromGitter> <mixflame> as long as I can read something and try to believe this isn't about nazi meth
<FromGitter> <naqvis> agree
<FromGitter> <mixflame> i. might feel better
deavmi has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
zorp_ has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
alexherbo2 has joined #crystal-lang
deavmi has joined #crystal-lang
<FromGitter> <jasonm23> Hi can anyone tell me if array splat is available (somehow) in a case when. for example. ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5f48e57c9566774dfe3a5753]
<FromGitter> <jasonm23> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f48e67e59ac794e02d01bdc]
<FromGitter> <j8r> no
<FromGitter> <j8r> use a Tuple instead
<FromGitter> <j8r> you can also do `when .in? words`
<FromGitter> <jasonm23> `{"zero", "one"...} etc?`
<FromGitter> <jasonm23> then ... ⏎ ⏎ `when .in? words`
<FromGitter> <jasonm23> `words = Tuple.from %w(zero one two three four five) # is ok?`
alexherbo2 has quit [Ping timeout: 258 seconds]
<FromGitter> <j8r> it will work with array
<FromGitter> <j8r> After testing, only work with passing args to a methods, not inside a `when`
<FromGitter> <alexherbo2> what is the fastest way to get the git root path?
<FromGitter> <j8r> `git rev-parse --show-toplevel`
<FromGitter> <Blacksmoke16> im surprised array doesnt define a `===` method that aliases to `includes?`
<FromGitter> <sclee15> Is there any Phoenix framework like pubsub system in Crystal?
<FromGitter> <Blacksmoke16> im not familiar enough to know of anything similar
<FromGitter> <Blacksmoke16> i made https://athena-framework.github.io/event-dispatcher/Athena/EventDispatcher.html but i couldnt say if its similar or not
<FromGitter> <Blacksmoke16> er, diff pattern, so no
postmodern has joined #crystal-lang
<FromGitter> <sam0x17> getting `Error: undefined fun 'clock_gettime' for LibC` suddenly on macos on a project that previously compiled -- any idea how to fix? did LibC change on macos?
<FromGitter> <Blacksmoke16> did you previously compile it on macos?
<FromGitter> <Blacksmoke16> current c bindings for libc dont actually include `clock_gettime`
<FromGitter> <Blacksmoke16> for macos*
<FromGitter> <Blacksmoke16> prob because that method doesn't actually exist in macos land. Are you using `LibC` directly?
<FromGitter> <dscottboggs> ```code paste, see link``` ⏎ ⏎ Does this mean there's no such thing as nested exceptions anymore? [https://gitter.im/crystal-lang/crystal?at=5f49335959ac794e02d0ff9a]
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Blacksmoke16> idt it works like that
<FromGitter> <Blacksmoke16> the cause is part of the exception itself, not `raise`
<FromGitter> <dscottboggs> ohh
<FromGitter> <Blacksmoke16> you prob want like `raise Exception.new "err", cause: io_error`
<FromGitter> <dscottboggs> yeah exactly, that worked
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <jwoertink> Anyone have a github action for installing shards v0.12.0?
<FromGitter> <Blacksmoke16> is it included via the nightly image?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f4934d29566774dfe3b3a65]
<FromGitter> <Blacksmoke16> yea
<FromGitter> <Blacksmoke16> otherwise prob have to build from source?
<FromGitter> <jwoertink> I wanted to keep using crystal 0.35. I figure I have to build from source, but I was curious if anyone had already done that so I could have a template to look off
<FromGitter> <Blacksmoke16> think theres a make file, so prob wouldnt be too bad
<FromGitter> <jwoertink> Probably just run `make && cp bin/shards /usr/local/bin` ?
<FromGitter> <Blacksmoke16> > You can download a source tarball from the same page (or clone the repository) then run make CRFLAGS=--releaseand copy bin/shards into your PATH. For example /usr/local/bin.
<FromGitter> <Blacksmoke16> looks like it yea
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f49366436e6f709fd0aff5b]
<FromGitter> <jwoertink> Assuming that there's no weird permission issues on the GH action container....
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
<FromGitter> <sanks64> @asterite I joined Gitter if you want to have a less formal conversation about #9707
<DeBot> https://github.com/crystal-lang/crystal/issues/9707 (Unexpected behavior of Int#/ on zero division)
alexherbo2 has joined #crystal-lang
V[excess] has joined #crystal-lang
V has left #crystal-lang [#crystal-lang]
deavmi has quit [Quit: Eish! Load shedding.]
sagax has quit [Remote host closed the connection]
<FromGitter> <asterite> @sanks64 it's okay but I'm not the one to talk to (I don't make changes in the language anymore)
<FromGitter> <mwlang> @jwoertink github If you have weird permission issues, there's always sudo, which works in those containers password-less.
<FromGitter> <jwoertink> Permissions seemed to be ok. What was missing was apparently `source` doesn't exist.... 😒 But I finally got it all running. Thanks for the tip @mwlang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 240 seconds]
Human_G33k has quit [Ping timeout: 265 seconds]
Human_G33k has joined #crystal-lang
sagax has joined #crystal-lang
Nekka has quit [Quit: zzz]
Human_G33k has quit [Ping timeout: 258 seconds]
alexherbo28 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo28 is now known as alexherbo2