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
<FromGitter> <watzon> @naqvis you around?
DTZUZU_ is now known as DTZUZU
<FromGitter> <jrei:matrix.org> You can PM on Gitter. And if you go on Matrix, also.
<FromGitter> <watzon> True. Just want to ask a question about his HTML parser. Guess I'll try PMing.
alexherbo2 has quit [Ping timeout: 246 seconds]
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 246 seconds]
<FromGitter> <naqvis> @watzon just got online
HumanG33k has joined #crystal-lang
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
deimos_ has quit [Ping timeout: 264 seconds]
hightower2 has quit [Ping timeout: 264 seconds]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 260 seconds]
Volk has joined #crystal-lang
chachasmooth_ has quit [Ping timeout: 264 seconds]
chachasmooth has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
<FromGitter> <Daniel-Worrall> How can I use HEREDOCs in named args where it's not the last arg. This seems like a bug. https://carc.in/#/r/a9rg
<FromGitter> <Blacksmoke16> prob could assign it to a var first
<FromGitter> <Daniel-Worrall> could do, would rather inline it :/
<FromGitter> <Blacksmoke16> https://carc.in/#/r/a9rk
<FromGitter> <Daniel-Worrall> that's awkward lol
<FromGitter> <Daniel-Worrall> I'll open an issue for it
<FromGitter> <Daniel-Worrall> Actually, there are some heredoc PRs so I'll test nightly
<FromGitter> <Daniel-Worrall> yeah, same thing on nightly
<FromGitter> <naqvis> https://carc.in/#/r/a9rm
<FromGitter> <naqvis> use `%` or `%q`
<FromGitter> <Daniel-Worrall> That's not a heredoc though
<FromGitter> <Daniel-Worrall> heredocs are parsed differently to %q/%
<FromGitter> <naqvis> but that serves the purpose
<FromGitter> <naqvis> in what sense?
<FromGitter> <Daniel-Worrall> The indentation based on the ending delimiter
<FromGitter> <Daniel-Worrall> Your example will have whitespace at the start of each line
<FromGitter> <naqvis> make sense, thanks @Daniel-Worrall
<FromGitter> <naqvis> yeah, seems like a bug, as inline heredocs works, but only for last argument
<FromGitter> <Daniel-Worrall> mhm
<FromGitter> <Daniel-Worrall> It's because the comma has to be on the last line of the argument
<FromGitter> <Daniel-Worrall> Parser conflicts
<FromGitter> <Daniel-Worrall> Also, @Blacksmoke16 oddly that begin/end code `crystal tool format` puts a newline between the heredoc and end
Volk has quit [Quit: See you next time!]
Stephie has quit [Quit: Fuck this shit, I'm out!]
Vexatos has quit [Read error: Connection reset by peer]
Vexatos has joined #crystal-lang
Stephie has joined #crystal-lang
<FromGitter> <Daniel-Worrall> What's the proper way to test class instance equality based on their properties
<FromGitter> <Daniel-Worrall> is there a macro for that maybe
<FromGitter> <naqvis> def_equals_and_hash (https://crystal-lang.org/api/0.35.1/Object.html#def_equals_and_hash(*fields)-macro)
<FromGitter> <Daniel-Worrall> sweet, thanks
<FromGitter> <naqvis> πŸ‘
deimos_ has joined #crystal-lang
_ht has joined #crystal-lang
postmodern has quit [Quit: Leaving]
_whitelogger has joined #crystal-lang
<FromGitter> <menih> Hi, I am new to Crystal - when do we expect to release v1? I am looking specifically for threading and IDE improvement before we can take a more serious attempt to use it in production. Specifically, with threading, need to allow multi thread, allow synchronous semantics, mutexes, semaphores, etc. With IDE, need full symbolic and language auto-completion, as well as interactive debugging, including breakpoints,
<FromGitter> ... variable evaluation, etc.
alexherbo2 has joined #crystal-lang
<FromGitter> <naqvis> @menih Welcome aboard. Crystal already supports parallelism (multiple threads) when compiled in MT mode, Standard lib already comes with `Mutex` semantic. For IDE there isn't any full-blown IDE support (though you can find plugins for editors like VSCode, Vim etc). Debugging support is present as well, but would require you to manually configure that on VSCode or use at command line. There is no announced date
<FromGitter> ... for V1 yet, but Crystal is already quite stable enough and in use in production by early adopters. So if you are relying your decision on having language achieve its V1 then you shouldn't consider yourself as early adopter :P ⏎ ⏎ Just my two cents
<FromGitter> <Daniel-Worrall> v1 was initially going to be the next release, but it got delayed for a reason I'm not aware of. Next release is 0.36.0 "soon". ⏎ Multithreading support is experimental as of right now, there are some gotchas in the stdlib, but you can definitely write MT safe code if you pay attention and use Mutex and Channels appropriately with regard to shared state and passing data. ⏎ IDEs, there is some support
<FromGitter> ... with LSP through https://github.com/elbywan/crystalline Auto-completion isn't there yet, but there is some support for diagnostics, goto, formatting, and symbols
<FromGitter> <Daniel-Worrall> Oh, there's debugging support as naqvis says, but I've yet to try it
hightower2 has joined #crystal-lang
<FromGitter> <Daniel-Worrall> I haven't actually dealt with a project that needed it, so that's why I haven't spent the time to look into it :D
<FromGitter> <naqvis> same here, but I know it exists :P
<hightower2> is that vscode editor shown in the screenshots in that thread?
<FromGitter> <naqvis> yeah
<FromGitter> <menih> thanks all for replies... seems like need a bit more maturity needed for our use case. Thanks again for prompt responses. I'll keep my eye on progression. I see a very bright future for crystal. It really sound too good to be true, so I hope it will get there. The three areas I've mentioned are pivotal to success - threading concurrency, decent IDE with symbolic auto-completion, and interactive debuggability.
<FromGitter> <Daniel-Worrall> As do I. Crystal really brings on its promises of the ease of use of Ruby and the speed of C.
<FromGitter> <Daniel-Worrall> I'd love to see you pop up either here or in the forums if you're in the market for remote Crystal Developers
<FromGitter> <Daniel-Worrall> There used to be a crystaljobs site but it's down :(
<FromGitter> <asterite> menih: interactive debuggability will never happen. This is a compiled language, and debuggers in such languages are never good. Or at least never as good as dynamic languages.
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
<hightower2> Hey I have a need to run something with 1 second of delay whenever a request for it comes in, regardless of how many other requests come in during that 1 second of waiting. I thought I could use channels for signalling, but they'll block when capacity is reached (instead I would just want to drop the extra messages during that 1 second window).
<FromGitter> <Daniel-Worrall> Could you elaborate on the functionality? 1 second of delay for *every* request? Or just an initial 1 second delay and ignore any requests that come in while this delay occurs?
<hightower2> So right now I use an Atomic#compare_and_set to make sure only one succeeds, and then I send a request through the channel, which upon receiving, waits 1 second, runs then thing, and resets the atomic value.
<hightower2> So, it's an endless loop, doing: (1) wait for request, (2) when it comes in, schedule something to happen after 1 second, (3) ignore any other requests that come in during that 1 second, (4) when time elapses and action executes, reset flag to accept new requests
ua_ has quit [Ping timeout: 260 seconds]
<hightower2> (working on a carc example)
<hightower2> basically currently I'm using this: https://carc.in/#/r/a9tf
<hightower2> and wondering if there's any more efficient way to do it
<hightower2> (Note: that carc example seems to never print "already_scheduled", which it should... not sure why that is, but the idea should be clear anyway.)
<FromGitter> <Daniel-Worrall> I'll take a look once I wrap my head around this model stuff I'm struggling with lol
deavmi has quit [Read error: Connection reset by peer]
<hightower2> here it is fixed: https://carc.in/#/r/a9th
<hightower2> so this works as-is... just wondering if there is something more efficient for the same effect.
ua_ has joined #crystal-lang
<hightower2> And btw, what I'm working on is: https://imgur.com/a/y8ZSW0N
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
<FromGitter> <Daniel-Worrall> Yeah, I've seen it a couple times before. Looks neat :)
<hightower2> started from scratch with some lessons from previous attempts, and came to this point during the holiday break
<FromGitter> <Daniel-Worrall> Man, HEREDOCs are like black magic
<FromGitter> <naqvis> Indeed they are :P
<FromGitter> <naqvis> only magicians like Ary are able to use them :P
gangstacat has joined #crystal-lang
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
postmodern has joined #crystal-lang
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 246 seconds]
^ has quit [Remote host closed the connection]
V[excess] has joined #crystal-lang
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deimos_ has quit [*.net *.split]
issyl0 has quit [*.net *.split]
snapcase has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
dom96 has quit [Ping timeout: 246 seconds]
issyl0 has joined #crystal-lang
snapcase has joined #crystal-lang
deimos_ has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
deavmi has joined #crystal-lang
dom96 has joined #crystal-lang
fifr[m] has quit [Ping timeout: 240 seconds]
<FromGitter> <erdnaxeli:cervoi.se> wow this is so weird
<FromGitter> <erdnaxeli:cervoi.se> but good to known
hightower2 has quit [Ping timeout: 264 seconds]
<yxhuvud> they are weird but work mostly like they do in ruby
<FromGitter> <erdnaxeli:cervoi.se> yeaaah, I always have a weird feeling with those calls to ruby, as I never did ruby before :p
fifr[m] has joined #crystal-lang
<repo> hey Blacksmoke16: is it possible to configure athena without using a yaml file?
<repo> e.g. programmatically?
<repo> i'd like to configure it using env vars
fifr[m] has quit [Ping timeout: 260 seconds]
fifr[m] has joined #crystal-lang
<FromGitter> <repomaa> @Blacksmoke16 not sure if you got a notification from irc without the `@`
<repo> i also have the issue that i can't write custom config classes that have required attrbutes. (not initialized directly in all initializer methods...)
<repo> and it's not clear to me for what i need the ConfigurationResolver
<yxhuvud> That depends on what irc client you use. It is not something that is standardized.
<repo> i'm using weechat
<repo> and parse_relay_msg.pl but it doesn't seem to be working...
<repo> *parse_relayed_message.pl
<repo> @Blacksmoke16: here's my attempt to add a custom config: https://p.jokke.space/SoK/
<repo> hm ok i can see why
<repo> there's an empty initializer
<FromGitter> <naqvis> repo: I assume you also need to override `Athena::Config::ConfigurationResolver`
<repo> naqvis: yeah i did, no change
<FromGitter> <naqvis> and you are unable to access `config` inside services?
<FromGitter> <Blacksmoke16> mm let me catch up
<FromGitter> <Blacksmoke16> yea so the configuration stuff atm is all fairly coupled with yaml
<FromGitter> <Blacksmoke16> a bit longer term i had the vision that you could do stuff in yaml like `host: !crystal/env HOST`
<FromGitter> <Blacksmoke16> have you tried just not including that module?
<FromGitter> <Blacksmoke16> using the block version of the `getter` macro might be fine, `getter credentials : Credentials { Credentials.new }` where internally that credentials type uses `ENV`
<FromGitter> <Blacksmoke16> im not super happy with the yaml config stuff, just not sure how i want to handle it if i went some other direction
<repo> Blacksmoke16: mhm ok cool. Yeah for my projects i've used https://github.com/repomaa/env_config.cr
<FromGitter> <Blacksmoke16> env vars are deff the simplest, but it doesnt really allow for more complex values than strings
<FromGitter> <Blacksmoke16> easily at least
<FromGitter> <Blacksmoke16> my thinking with the yaml was it would be possible to have some external build step that generates it based on the env it'll be running on
<FromGitter> <Blacksmoke16> but idk, i'm open to alternatives to allow removing yaml as a dep. I could just me over thinkings all this
<FromGitter> <Blacksmoke16> could just be*
<repo> Blacksmoke16: see my shard, it supports quite a few data types
<FromGitter> <jrei:matrix.org> all is about strings at first
<FromGitter> <jrei:matrix.org> the question is the parsing
<repo> ^
<repo> not trying to say env_config is perfect, i wrote it a long time ago and it could certainly need some love, but just for demonstration purposes: it's possible to map env vars to a quite complex config structure
<FromGitter> <jrei:matrix.org> does Athena requires having YAML then?
<repo> yeah
<FromGitter> <jrei:matrix.org> too bad :( It would be better to be like the stdlib's `Log`
<FromGitter> <jrei:matrix.org> programmatically configurable, optional YAML configuration
<FromGitter> <jrei:matrix.org> plus env vars support :)
<FromGitter> <Blacksmoke16> > does Athena requires having YAML then? ⏎ ⏎ it doesn't really *require* it, but fwiw it is possible to not use it
<FromGitter> <Blacksmoke16> env vars would just be hard for the type of stuff it uses yaml for
<FromGitter> <jrei:matrix.org> maybe, I don't really know what's all possible.
<FromGitter> <jrei:matrix.org> just that?
<FromGitter> <Blacksmoke16> atm yea
<FromGitter> <jrei:matrix.org> YAML is definitely not worth it IMO
<FromGitter> <Blacksmoke16> there is another section in some in progress work
<FromGitter> <jrei:matrix.org> I'd use INI or env vars instead, like Gitea and KDE do
<FromGitter> <Daniel-Worrall> Just write your env var as a json object :^)
<FromGitter> <Blacksmoke16> still dont think env vars would be great for this kinda stuff
<FromGitter> <Blacksmoke16> but programmatic approach could be a good solution
<raz> env vars are the best
<FromGitter> <jrei:matrix.org> For such simple conf, yes
<FromGitter> <jrei:matrix.org> and you can even use https://github.com/gdotdesign/cr-dotenv
<FromGitter> <jrei:matrix.org> env vars are practical in Docker environments
<raz> yup, 12factor
<FromGitter> <Blacksmoke16> way things are designed atm it would be pretty easy for the end user to customize how the config obj is provided and forgo yaml
<raz> i just use this teeny macro to turn env vars into consts. complains at startup if they're not set. works like a champ
<FromGitter> <jrei:matrix.org> @Blacksmoke16: right, for this case better using JSON/YAML
<FromGitter> <jrei:matrix.org> personally, I'm not a fan of all this complex runtime configuration that frameworks provide
<FromGitter> <jrei:matrix.org> I don't mind re-deploying the app to change the configuration
<FromGitter> <anapsix> Greetings! ⏎ I'm using the following method to check if TCP endpoint accepts connections ⏎ how horrible is it? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6005c164cd31da3d9abe0519]
<FromGitter> <anapsix> I suppose it should be called `reachable?`
<FromGitter> <Blacksmoke16> @jrei:matrix.org to be clear its not really runtime configuration as its loaded and not really changeable after starting the app
<FromGitter> <jrei:matrix.org> so, why not using Crystal then?
<FromGitter> <jrei:matrix.org> if I see a JSON/YAML file, I can think to change it and reload the app to change its configuration
<FromGitter> <Blacksmoke16> :shrug: i guess the only reason i can think of is it makes things less verbose, like if you had a few rules to configure
<FromGitter> <jrei:matrix.org> Not sure. A Crystal NamedTuple would be as-verbose
<FromGitter> <Blacksmoke16> but for the amount of stuff thats configurable atm, prob not a problem
<FromGitter> <Blacksmoke16> esp given both yaml configurable things are optional
<FromGitter> <jrei:matrix.org> repo then, I don't really see the point of env vars for compile-time
<FromGitter> <jrei:matrix.org> at least if makes more sense to me than a JSON/YAML
<FromGitter> <jrei:matrix.org> For example Lucky uses https://github.com/luckyframework/habitat#usage
<FromGitter> <Blacksmoke16> for sure
<FromGitter> <naqvis> @anapsix you'd better use `connect_timeout` argument of `TCPSocket.new` to timeout at specified interval, instead of waiting for long time
<FromGitter> <anapsix> @naqvis afaik, it doesn't wait if endpoint which is being checked is not yet listening
<FromGitter> <naqvis> attempt should drop if connection port not yet listening instead of hanging for system defined timeout, that’s why you have retry mechanism. As your intention is to identify quickly if specific port is up and ready for connection
<FromGitter> <anapsix> the intention is to wait roughly as long as the timeout and keep retrying to connect
<FromGitter> <anapsix> return failure if connection could not established after reaching timout
<FromGitter> <naqvis> so you should check what kind of exception is being raised, if connect error you can do a short sleep and retry, but if its connect timout then abort
<FromGitter> <anapsix> which is pretty much what I ended up doing ⏎ was wondering is there's a more elegant way
<FromGitter> <naqvis> elegant in what sense?
<FromGitter> <naqvis> don’t perform a complete handshake? behave like nmap?
<FromGitter> <anapsix> something more graceful, something that supports "timeout" and keeps retrying on it's own, without me having to sleep and try again :D ⏎ since I only need to check if port if is open and accepting connections
<FromGitter> <naqvis> haven’t seen any language where stdlib comes with such feature, it’s always custom code, you already made a func, but for sure you can move that to shard for others to use πŸ˜„
deavmi has quit [Read error: Connection reset by peer]
<FromGitter> <anapsix> alright... just checking, thanks!
<FromGitter> <naqvis> πŸ‘
deavmi has joined #crystal-lang
<raz> i think go-lang has some stuff around timeouts baked in
<raz> it's prob not easy to generalize, but would be nice to have something robust in stdlib, since people inevitably get it more or less wrong every time (no exponential backoff, no jitter etc.)
ua_ has quit [Ping timeout: 246 seconds]
<FromGitter> <anapsix> came up with this.. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6005d6d9ac653a0802c85773]
daemonwrangler has quit [Quit: ZNC 1.7.5 - https://znc.in]
deavmi has quit [Ping timeout: 246 seconds]
<FromGitter> <andrewc910> Hey, I saw the forum post about 0.36.0. What's up with 1.0? What's the reason 1.0 was pushed back?
<FromGitter> <Blacksmoke16> its just been so long since the last release
<FromGitter> <andrewc910> I get why 0.36.0 is being released.
<FromGitter> <andrewc910> More curious what's the hold up on 1.0
ua_ has joined #crystal-lang
<FromGitter> <jrei:matrix.org> not sure what difference will it be between 1.0 and an hypothetical 0.36.1
<straight-shoota> effectively, 1.0 wasn't pushed back by 0.36.0, it's just inserted in between
<FromGitter> <Blacksmoke16> prob is a lot going on behind the scenes
<straight-shoota> *(at least not more than 1.0 was already delayed before)
<straight-shoota> essentially, 1.0.0-pre1 has been rebranded as 0.36.1 for having so many changes
ua_ has quit [Excess Flood]
<straight-shoota> at this point, we would have definitely required a 1.0.0-pre2, so that's just going to be called 1.0.0-pre1 now
<straight-shoota> (and potentially a 0.36.x between if anything needs fixing after the release)
<straight-shoota> (which is very likely considering the amount of changes in master)
hightower2 has joined #crystal-lang
deavmi has joined #crystal-lang
ua has joined #crystal-lang
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
hightower2 has quit [Ping timeout: 264 seconds]
<FromGitter> <asterite> j8r the difference is 0.64 vs 0.63.9
deavmi has joined #crystal-lang
<FromGitter> <anapsix> I would like to publicly thank @bcardiff for https://github.com/bcardiff/ghshard ⏎ Thank you, Brian. I found ghshard very helpful.
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> @anapsix: how did you discover this repo?
<FromGitter> <anapsix> I was looking for docs on how to submit a shard to crystalshards.org, and found this by accident.. ⏎ Later, I realized crystalshards.org is finding shards automagically :)
deavmi has quit [Ping timeout: 264 seconds]
<FromGitter> <bcardiff> Thanks @anapsix it’s might be a bit to opinionated but I’m glad you like it.
<FromGitter> <anapsix> created in Dec 2016, last updated in Nov 2018 - works well
deavmi has joined #crystal-lang
<FromGitter> <jrei:matrix.org> @asterite: there should have no breaking changes between 0.36 and 1.0, right?
<FromGitter> <jrei:matrix.org> That's all good, 1.0 to be like ~0.36.2 + LTS
deavmi_ has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
<FromGitter> <jrei:matrix.org> IIRC some projects did even promote a 0.x version to 1.0, the 2 being identical
<FromGitter> <asterite> No idea, but I'm sure there will be breaking changes
<FromGitter> <jrei:matrix.org> I hope too, but just small ones
<FromGitter> <jrei:matrix.org> It won't be wise to have big ones
<FromGitter> <jrei:matrix.org> In a sense, if the 1.0 is like the 0.36.2, pre-releases won't even be necessary
<straight-shoota> I guess we'll figure that out after 0.36.0 is released
_ht has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
<FromGitter> <jrei:matrix.org> Maybe, but there is the VERSION file (no big deal)
<straight-shoota> Yeah well, that can always need to change
<straight-shoota> after releasing x.y there's always some uncertainty about whether the next release is x.(y + 1) or (x + 1).0
<FromGitter> <jrei:matrix.org> VERSION must be a semantic one?
hightower2 has quit [Quit: Leaving]
HumanG33k has quit [Read error: Connection reset by peer]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <watzon> Is it possible to `{% debug %}` an entire file so that you can see all generated code?
<FromGitter> <Blacksmoke16> idt it works like that, you put it in macro code and it shows that expansion
<FromGitter> <watzon> Right, that's why I'm wondering. I'm getting an error without a helpful trace (using `--error-trace`) that's giving me a line number where the error couldn't possibly be occurring. So I'm pretty sure it's giving me an adjusted line number that comes from after code has been generated by my macros.
<FromGitter> <watzon> It would be really helpful to be able to debug the whole file the way you can a single macro
<FromGitter> <Blacksmoke16> maybe could use that other crystal tool thing for this
<FromGitter> <watzon> `expand`?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <watzon> Doesn't seem to do any more than `{% debug %}` does
<FromGitter> <Blacksmoke16> welp, thats all i got
<FromGitter> <watzon> Oh well I'll have to do some good ol' fashioned print debugging
<FromGitter> <watzon> Figured it out
<FromGitter> <Blacksmoke16> that was quick
<FromGitter> <watzon> Yeah ended up being easier to track down than I thought it'd be