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> <HertzDevil> do we have a clear stopping point for 1.0.0-pre1 yet
<straight-shoota> nope
<FromGitter> <HertzDevil> πŸ˜”
<straight-shoota> not sure what we're waiting on
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 272 seconds]
chachasmooth has quit [Ping timeout: 240 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <Daniel-Worrall> @RespiteSage I setup a private leaderboard for Crystal on my account and shared it in the crystal discord. Forgot to share it here
<FromGitter> <Daniel-Worrall> 659296-5f6e13e0
chachasmooth has quit [Ping timeout: 256 seconds]
chachasmooth has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
ua has quit [Ping timeout: 265 seconds]
ua has joined #crystal-lang
f1refly has quit [Quit: bye fags]
f1refly has joined #crystal-lang
<kevinsjoberg> Not too happy with my solution today. https://github.com/KevinSjoberg/aoc-2020/blob/main/02/day02.cr
<kevinsjoberg> Kind of repetitive when referencing the matchdata over and over. And the explicit casting I can't do much about. At least it works.
<kevinsjoberg> If you see improvements I'd love to hear it. πŸ™‚
<yxhuvud> Why are you bothering to create a class?
<kevinsjoberg> Does it matter? I'm more concerned about the implementation. I'm aware I could just have methods in the global object. I will probably clean up a bit later, I'll have each day wrapped in a module instead, and then a class for more complicated problems.
<kevinsjoberg> Ignore that for now. πŸ™‚
<raz> hm hm, one thing that i always find an eyesore (in many languages) are the constant `hash["foobar"]` references. it's annoying to read and write. that's one of the few things i like about js, where you can often just say `hash.foobar`. i wonder if sth like that could be considered as syntactic sugar for crystal.
<raz> (or more specifically i wonder: are there terrible side-effects and problems that it would cause?)
<jhass> you could do it as a decorator
<FromGitter> <naqvis> here you go raz ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5fc77f4087cac84fcd033d4c]
<jhass> aww, too slow
<FromGitter> <naqvis> quick and dirty approach
<jhass> but still I wouldn't monkey patch, I would decorate
<FromGitter> <naqvis> :D
<raz> uhlala! 🧐
<jhass> have a struct wrappking a Hash(String, V) and wrapping child hashes
* raz is tempted to actually try that out and see how it goes
<raz> i suppose it could interfere with other uses of method_missing, but other than that... hmmm.
<jhass> record Properties(V); data : Hash(String, V) { macro method_missing(call); data[{{call.name.id.stringify}}]; end } + wrapping if the child value is a Hash(String, _) too
<jhass> then just monkey patch Hash with def p; Properties.new(self); end; or so
<raz> ya, i think i will try that out in one part of my codebase
<raz> just to see whether it blows up terribly or is actually the future of crystal
<FromGitter> <naqvis> God forbid :P
<jhass> yeah, I have lots of semantic concerns :)
<FromGitter> <naqvis> don't like this terribly pythonic way into crystal
<jhass> dedicated decorator ain't so bad
<FromGitter> <naqvis> yeah true
<FromGitter> <naqvis> but not something cooked into language
<raz> what are the concerns tho, i'm curious? i'm sure i'm missing something but can't think of what it is
<jhass> because it can restrict to string keys and doesn't conflict with standard methods
<jhass> First of all, it can only work for Hash(String|Symbol, _)
<jhass> second it's super easy to clash with one of the tons of methods on Hash
<raz> hmm yea... true on that
<raz> well, i'm a simple man. i'm mostly like... instead of
<FromGitter> <ImAHopelessDev_gitlab> helloooooooo
<raz> `foo["gimme_something_i_can_call"].try &.call["ok_now_this"].try &.and_maybe_that`
<raz> i would kinda prefer to write something like
<raz> `foo.gimme_something_i_can_call&.call.ok_now_this&.and_maybe_that`
<raz> but these are just random coffee thoughts for now. i'll give that little macro a shot to learn how wrong i am :D
<FromGitter> <ImAHopelessDev_gitlab> hashes = bracket notation ⏎ structs/classes = dot notation
<FromGitter> <ImAHopelessDev_gitlab> @raz i just use a struct or class at that point. i liked that from JavaScript too
<FromGitter> <bararchy> Oh, how I want case insensitive `.includes?()`
<jhass> .any? .casecmp or something
<FromGitter> <bararchy> hmmmm .any? would mean I need something like `{all_possible_case_mutations}.any? {}`
<FromGitter> <naqvis> `["Hello","World"].includes?("hello") # => false`
<jhass> wait, String#includes? Enumerable#includes?
<jhass> which one?
<FromGitter> <bararchy> String.includes?
<jhass> mmh, #compare can do case insenstive full match
<FromGitter> <bararchy> Does it use libPCRE?
<jhass> I think it's inbuilt
<jhass> using some unicode tables
<jhass> #index(Regex) or .downcase.includes?(.downcase) are the other options I see
<jhass> one or the other is probably faster depending on small vs large input
<jhass> well, for Regex just matches?, no need for index
<FromGitter> <bararchy> `Regex` and LibPCRE are an issue as it might not be a true string (blobs) and makes libpcre to invalid mem access. ⏎ `downcase` is risky as my input is large, and it does too many mem allocations
<FromGitter> <bararchy> `compare` is nice, but it's `==` I want to see if `LargeString.includes?(PartialString`)
<straight-shoota> barachy it should be easy to adapt the implementation of String#compare for this use case
MasterdonX has quit [Ping timeout: 265 seconds]
<erdnaxeli> hi, is there any reason that the logger does not write to stderr by default?
<FromGitter> <Blacksmoke16> it can write to whatever you want it to, but not all logs are errors
<FromGitter> <Blacksmoke16> would be fairly easy to make something to do what you want
<straight-shoota> I presume the question is about why the default was chosen as it is
<FromGitter> <tenebrousedge> I think that today is a good day to use my crystal `scanf` lib
<FromGitter> <tenebrousedge> hmm, maybe I don't need integers there though
<FromGitter> <Blacksmoke16> id imagine stdout is more convenient when just wanting to see the output
<erdnaxeli> yep the question was about the default
<erdnaxeli> I know I can change it :)
<erdnaxeli> I just surprised me that Log.info write to STDOUT
<erdnaxeli> it just*
<straight-shoota> Yeah, it depends on the type of application what you expect
<straight-shoota> for a CLI app that processes streams from stdin/stdout, you would expect to stderr. But a server application would log to stdout.
<FromGitter> <j8r> even `log.error`?
<FromGitter> <j8r> anyway as said, it is configurable
<straight-shoota> yes, there's no point in redirecting log events to different streams based on severity. At least not by default.
<FromGitter> <j8r> simpler to have every log in the same place by default yes
<jhass> on the contrary, it would easily lead to an out of order combined log
<erdnaxeli> yes
<FromGitter> <j8r> for example it is usually wanted for reverse proxies/ http servers. Depends of the app, indeed
<erdnaxeli> I agree
<erdnaxeli> btw IΒ love that crystal is simple enough to just write a 10 lines one shot script
<FromGitter> <Blacksmoke16> i'd hope you're building the script and not just using it like bash
<erdnaxeli> why?
<FromGitter> <Blacksmoke16> is not as efficient since it has to recompile the script everytime
<FromGitter> <Blacksmoke16> maybe not a big deal, but deff slower than if you built it and just used the binary
<erdnaxeli> oh yes. But I am parsing a 300Mo CSV file, the compilation time is not significant here ^^
<erdnaxeli> it seems that it takes 2s to compile, on a 30s job
<FromGitter> <Blacksmoke16> fair enough, just something to keep in mind, esp for small quick scripts
<erdnaxeli> still, it is just a one shot script, IΒ already should have deleted it :p
<erdnaxeli> yes you're right
<raz> yup i've done that too. i usually write these one-shots in ruby - but when the data is big they can often run with minimal changes as crystal
<FromGitter> <RespiteSage> @Daniel-Worrall Thanks for the leaderboard!
<FromGitter> <RespiteSage> Also, TIL that you can assign variables to the first elements of an array with `a, b = arr`. Very useful for splitting input strings in todays AoC (don't think that's a spoiler).
<FromGitter> <j8r> or use partition
<yxhuvud> I have no idea how that would help with todays solution. that is probably an artifact of how your particular solution works
<FromGitter> <RespiteSage> Hm... I guess so. I just felt like `a, b = line.split(...)` was the most obvious solution for parsing.
<FromGitter> <RespiteSage> For reference, my solution for today: https://github.com/RespiteSage/aoc2020/blob/main/2.cr#L15 .
<FromGitter> <RespiteSage> (At the line where I'm using that.)
<FromGitter> <tenebrousedge> huh, `icr` blowing up for regexes. Neat
<FromGitter> <RespiteSage> @yxhuvud Wow, nice golfing! I'm mostly going for solving the puzzle relatively cleanly.
<yxhuvud> I think mine is clean :D
<FromGitter> <RespiteSage> That's fair. It's still more readable than basically any other language in that number of lines.
<FromGitter> <RespiteSage> Not saying it isn't clean; I suspect I'm probably thinking of "clean" in different terms than you are.
<yxhuvud> Well, AoC plays by different rules than other coding. No need to care about maintenance etc. I usually introduce slightly more structure in later tasks, but it just wasn't beneficial here.
<FromGitter> <RespiteSage> I look forward to seeing how more experienced devs (than me) solve the later puzzles especially.
<FromGitter> <RespiteSage> Yeah, that's true. I have to say that it's really nice not to worry about validating input.
<yxhuvud> oh you may want to do that while error seeking. :D
<yxhuvud> faulty assumptions about how the input works can easily break a solution.
<FromGitter> <RespiteSage> Yeah, I misread the Part 2 as an AND instead of a XOR, so my first solution was wrong.
<FromGitter> <RespiteSage> *OR instead of a XOR
<FromGitter> <RespiteSage> Also, I do have to agree with you (after looking at it a bit more) that your solution is clean.
<FromGitter> <anapsix> greetings everyone! ⏎ I've wrote some code to configure my application, but I wonder if I'm over-complicating it ⏎ The idea here is to be able to create config with defaults, or read it from file, if present. The config file can be set via environment variable `MYAPP_CONFIG`. If any of the config options are missing from file, it woulduse defaults. ⏎ Would you take a look and let me know what you think,
<FromGitter> <j8r> looks good
<FromGitter> <j8r> also for debug, you could use `config.elasticsearch.to_yaml STDOUT`
<FromGitter> <j8r> Also, I don't really recommend `CONFIG = Config.new`
<FromGitter> <anapsix> > also for debug, you could use `config.elasticsearch.to_yaml STDOUT` ⏎ ⏎ ah, good point
<FromGitter> <j8r> the constant can cause headaches in specs. a class getter could at least enabled to overwrite the class var in specs
<FromGitter> <j8r> for example to test different confs
<FromGitter> <j8r> also, no need to define defaults in the getters
<FromGitter> <j8r> they are already defined in the initializer
<FromGitter> <j8r> also, the `key: "host"` annotations can be superfluous
<FromGitter> <Blacksmoke16> remember your SOLID principles :p
<FromGitter> <Blacksmoke16> injecting a `Config` obj as an initializer arg would be much easier to test
<FromGitter> <j8r> sure, but can be very annoying to pass a config object around
<FromGitter> <anapsix> > they are already defined in the initializer ⏎ ⏎ but if I don't do it in both places (getter and initializer) I'll have a discrepancy of defaults when creating `App::Config` from file, and default when file is not readable.. wouldn't I?
<FromGitter> <Blacksmoke16> i mean instantiate a `Config` object once, and have it be passed to the things that need config info, versus using a global const to access them
<FromGitter> <Blacksmoke16> @j8r can be, are solutions/ways to make it less painful tho
<FromGitter> <Blacksmoke16> like really just doing `def initialize(@config : Config = CONFIG); end` might be enough
<FromGitter> <Blacksmoke16> use the global singleton by default, but still allows providing a mock for testing
<FromGitter> <j8r> but no hash of symbols
<FromGitter> <j8r> not a good idea this comment
<FromGitter> <Blacksmoke16> a constant is prob good enough for what you want
<FromGitter> <Blacksmoke16> `CONFIG = Config.new`
<FromGitter> <anapsix> sooo.. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fc7d1937fe316314d9d14fb]
<FromGitter> <anapsix> no need to use ⏎ ⏎ ```private def initialize(@@config : Config = Config.new); end``` [https://gitter.im/crystal-lang/crystal?at=5fc7d2b07db659462afd1a8d]
<FromGitter> <anapsix> or ⏎ ⏎ ```private def initialize(@@config : Config = CONFIG); end``` [https://gitter.im/crystal-lang/crystal?at=5fc7d2cf4b2a214fbdc614c7]
<FromGitter> <Blacksmoke16> sorry to be clear i mean you use that initializer for things that *USE* config, not in the Config type itself
<FromGitter> <anapsix> ah, right ⏎ maybe I'm lazy, but using MyApp::CONFIG seems easy enough
<FromGitter> <Blacksmoke16> sure, but gl testing that
<FromGitter> <anapsix> we'll burn that bridge when we come to it :P
<FromGitter> <anapsix> thank you for your input @j8r and @Blacksmoke16 ⏎ always appreciated
<FromGitter> <anapsix> <3
MasterdonX has joined #crystal-lang
<frojnd> Hi there. I'm using google cloud apis and return string gives me with quotes: `"foo bar"` so when I build a json with JSON.build json.field "foo" bar ... bar being "foo bar" with double quotes it end json looks like this: { "foo": "\"bar\"" } can I somehow remove first and last double quote from a string... I also noticed it escapes new lines so simetimes I see { "foo": "\"bar\"\n" }
<FromGitter> <tenebrousedge> I guess the simple way would be `string[1..-2]` but idk about the json field stuff
<FromGitter> <Blacksmoke16> are you sure its actually a problem and not just being escaped for printing to console?
<frojnd> Yeah ur right
<frojnd> I forgot I'm using jq to get the translated string from google api :/
<frojnd> I have -r option there to get string without double quotes and hopefully without new lines
<FromGitter> <Blacksmoke16> should use `oq` πŸ˜‰
<frojnd> Yeah, jq -r works like a charm
<frojnd> Or maybe not
<oprypin> frojnd, something isn't right there. you gotta fix it at the api level so it doesn't give you that
<frojnd> I still have `\n` inside json
<frojnd> Well google apis translate translates everything each char
<oprypin> show
<frojnd> Maybe I'm passing new lines
<oprypin> show what you gave to it and what it have to you
<FromGitter> <anapsix> > should use `oq` πŸ˜‰ ⏎ after discovering `oq`, I no longer use `yq`
<FromGitter> <Blacksmoke16> as it should be ha
<FromGitter> <anapsix> gotta release some more binaries, and add `oq` to https://github.com/devops-works/binenv/blob/develop/distributions/distributions.yaml
<FromGitter> <anapsix> also, `yq` is now trying to like `jq`
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <anapsix> see v4 release notes ⏎ https://github.com/mikefarah/yq/releases
<FromGitter> <Blacksmoke16> oh *that* `yq` i was thinking of https://github.com/kislyuk/yq
<raz> gron > jq
<FromGitter> <anapsix> neaty
<FromGitter> <anapsix> I do often struggle with more complex jq queries, gron would make things easier
<frojnd> I found the issue
<erdnaxeli> hi, can IΒ give a proc created from a method where a block is expected?
<frojnd> chomp to the rescue: `bash foo.sh`.chomp
<erdnaxeli> I would like to do something like this:Β https://carc.in/#/r/a1bz
<FromGitter> <Blacksmoke16> https://carc.in/#/r/a1c2
<erdnaxeli> thanks
<erdnaxeli> so a proc is not a block, but a captured block is a proc
<erdnaxeli> yeah I just read it again πŸ˜…
<FromGitter> <Blacksmoke16> kinda related, not sure im the biggest fan of how much nesting the new docs have
<FromGitter> <Blacksmoke16> used to be able to read thru all the sections, now kinda have to know what's under what section...
<frojnd> β€œThey Have Nothing to Eat.” google api translate returns as: "translatedText": "\"Sie haben nichts zu essen.\""
<erdnaxeli> I agree, I can't search in the page anymore, I have to use the search box. Not a big deal, but a habit to change
<straight-shoota> Blacksmoke16, nesting is exactly the same as before
<straight-shoota> subsections are just collapsed by default
<straight-shoota> but that can be changed
<FromGitter> <Blacksmoke16> ^ prob would be helpful
<straight-shoota> just open an issue ;)
<straight-shoota> erdnaxeli, could you search the entire website in the browser before?
<erdnaxeli> no but I could search the sections as they were not collapsed by default
<straight-shoota> yeah that can be changed back
<oprypin> frojnd, yea so what's the problem?
<oprypin> you added those quotes
<FromGitter> <Blacksmoke16> fair point, could be a nice `index` page πŸ˜‰
<oprypin> yea that an easily be added to the bottom of https://crystal-lang.org/reference/
<straight-shoota> oprypin: $$(".md-nav__toggle").forEach(function(elem){elem.checked = true})
<oprypin> straight-shoota, there is a more real problem that this kind of nav doesn't support keeping the vertical scroll position
<oprypin> so u go to https://crystal-lang.org/reference/syntax_and_semantics/c_bindings/alias.html and u don't even see it on the left
<FromGitter> <Blacksmoke16> 😒
<oprypin> this would exacerbate that
<straight-shoota> yeah, the nav is just to huge
<oprypin> it is good to merge the pages now
<oprypin> there is the right-hand-side sub nav per heading
<straight-shoota> definitely
<straight-shoota> longer pages with toc is so much more useful than individual pieces covering only tiny aspects
<straight-shoota> and we could separate content into a few main sections with navigation tabs
<straight-shoota> the left hand nav menu should be 2 levels deep
<straight-shoota> max 3 on rare exceptions
<FromGitter> <ImAHopelessDev_gitlab> imagine paying $ for a collapsible html element
<straight-shoota> well you're not paying for the feature directly but support the author and allow him to improve stuff
<straight-shoota> for that support you get access to new features earlier
<FromGitter> <Blacksmoke16> https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/ this one is pretty cool too
<FromGitter> <j8r> @Blacksmoke16 after looking at oq, it could use crystalizer to convert format one between another
<FromGitter> <j8r> I just didn't implement yet XML :/
<FromGitter> <Blacksmoke16> xml is a pita, the others are pretty straightforward
<FromGitter> <Blacksmoke16> not sure id get much benefit from using it
<FromGitter> <j8r> I will add INI support
<FromGitter> <j8r> not sure it is useful, but oq querying Crystal objects
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Blacksmoke16> how would that work?
<FromGitter> <j8r> so, oq takes a file and a type, then it appends this to a temp file and append a line to convert to json.
<FromGitter> <j8r> then the crystal compiler can output the Crystal object as json
<FromGitter> <j8r> *any type
<straight-shoota> oprypin, any idea why six checks show up on https://github.com/crystal-lang/crystal-book/pull/445 and all of them failing with no apparent reason?
<FromGitter> <j8r> actually, giving a type could even be optional
<straight-shoota> oh, now it completed just fine
<FromGitter> <j8r> At hen end, a Crystal program is a list of Objects :)
<FromGitter> <j8r> (not only)
<FromGitter> <Blacksmoke16> parsing crystal objects into json isnt the purpose of `oq` πŸ˜‰
<FromGitter> <Blacksmoke16> make another cli for that and pipe it into `oq` ha
<FromGitter> <j8r> yeah
<FromGitter> <j8r> oq is for parsing data formats
<FromGitter> <j8r> .cr is not one of those...
<FromGitter> <Blacksmoke16> mhm
<FromGitter> <j8r> for instance, I was thinking of `cat app.cr | oq -o json`
<FromGitter> <j8r> bad idea, nvm, the opposite can't be done
<FromGitter> <Blacksmoke16> call .inspect on the obj, serialize the string as bytes :p
<FromGitter> <j8r> it was not possible to link directly to the jq C library?
<FromGitter> <Blacksmoke16> dunno, didnt try
<FromGitter> <Blacksmoke16> dont really know C and i imagine it would be a pita for prob not much gain?
<FromGitter> <j8r> that's essentially to have oq useful with just DL the binary
<FromGitter> <Blacksmoke16> fair point
<FromGitter> <j8r> or statically link the jq binary, and ship it with oq
<FromGitter> <Blacksmoke16> id accept a PR πŸ˜‰
<FromGitter> <j8r> > To build a statically linked version of jq, run: make LDFLAGS=-all-static
<FromGitter> <j8r> fine ;)
<FromGitter> <j8r> @Blacksmoke16 there is https://github.com/stedolan/jq/releases
<FromGitter> <j8r> and I checked, the binary is statically linked :o
<FromGitter> <Blacksmoke16> so?
<FromGitter> <j8r> so, it can be directly included with the oq release tarball
<FromGitter> <j8r> and will work of all linuxes
<FromGitter> <Blacksmoke16> ah, hmm
<FromGitter> <j8r> Or I think you could just add a mention to this release page
<FromGitter> <j8r> so if one want to use oq on a limited, non-root environment, it can DL jq there
<FromGitter> <j8r> as you wish :shrug:
<FromGitter> <Blacksmoke16> assuming you're using a package manager, brew/snap will auto install jq
<FromGitter> <j8r> but you need to be root usually, except on BSD
<FromGitter> <Blacksmoke16> true, rather not be responsible for providing a `jq` binary
<FromGitter> <Blacksmoke16> is easy enough to just go over there and get it, versus needing to manage which version people get etc
<FromGitter> <j8r> yes. Just saying, that's not always easy.
<FromGitter> <j8r> no problem so war anyway...
<FromGitter> <Blacksmoke16> mhm, premature optimization :P
<FromGitter> <j8r> I don't know, as a user, I like to just download an have the thing work
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> what would be nice: notepad++ addon for crystal, that lists all the method names for each Class. which when clicked, goes to the method
<oprypin> who uses notepad++
<FromGitter> <Blacksmoke16> @ImAHopelessDev_gitlab
<FromGitter> <watzon> I want to know not who, but why anyone uses Notepad++. I mean I get it, I started with it back in the day, but I don't think I've touched it once since 2010.
<FromGitter> <ImAHopelessDev_gitlab> notepad and notepad++ still amazing til this day, and over time with the degradation of bloatware apps, will continue to even be more amazing
<FromGitter> <watzon> But vim
<FromGitter> <ImAHopelessDev_gitlab> i switched from vscode to regular notepad and yielded like 500mb ram
<FromGitter> <ImAHopelessDev_gitlab> vim good too, i guess i just haven't got into it cuz console experience is hard for me
<FromGitter> <Blacksmoke16> i mean who really cares about 500mb...
<FromGitter> <watzon> I'm going to try and do all of my AoC challenges with just vim. So far I have day 1 in C and day 2 in C++, both wholly with Vim.
<FromGitter> <watzon> I'm also going for a different language each day. God help me.
<FromGitter> <ImAHopelessDev_gitlab> DΓ©jΓ  vu, we been through this last year. but i mean you are right it's not a lot but it is what it is
<FromGitter> <Blacksmoke16> it should be expected given one is a text editor, not an ide
<FromGitter> <watzon> I mean whatever works, it just surprises me given how powerful and light other IDEs have become. VSCode is surprisingly lightweight for what it's made with.
<FromGitter> <ImAHopelessDev_gitlab> @watzon doesn't' that get irritating doing it another language? or do you like the challenge of it (if it is)?
<FromGitter> <watzon> Then again, some people still use Ed
<FromGitter> <watzon> @ImAHopelessDev_gitlab I like the challenge. Gets me to think in different ways.
<FromGitter> <ImAHopelessDev_gitlab> if i use another language, i'll literally get upset and a headache
<FromGitter> <watzon> My headaches will come when I start trying to use Erlang and ADA
<FromGitter> <watzon> Lol
<FromGitter> <ImAHopelessDev_gitlab> yeah, nt
<FromGitter> <ImAHopelessDev_gitlab> nty
<FromGitter> <ImAHopelessDev_gitlab> i tried the functional language paradigm. ain't going through that again
<FromGitter> <watzon> I like it, but at the same time I feel like some languages take it too far
<oprypin> straight-shoota: at some point i will need some way to discover all the possible properties/types that the doc generator exposes. is there a list of all possible keys, a complete test suite or a demo project that exercises everything?
<FromGitter> <ImAHopelessDev_gitlab> a good analogy is: i'm a right handed person and can throw a baseball with good accuracy and speed. using a functional language makes me feel like I'm on the mound in the world series and required to throw with my left hand.
<FromGitter> <ImAHopelessDev_gitlab> and i've spent my entire life/childhood learning how to throw with my right hand, then i have to switch? WTFF
<straight-shoota> and the type specific files in that directory
<straight-shoota> but the data structure is very poor
<oprypin> poor? seemed logical and programmable to me
<straight-shoota> I've just hacked that together to get at least something out of the compiler
<oprypin> wait that can't be all of it
<straight-shoota> na, there's duplication, missing properties etc.
<oprypin> ah directory sorry
<oprypin> no i don't see
<oprypin> where's Class to_json
<straight-shoota> type.cr
<oprypin> straight-shoota: what about the latter part. any demo code?
<oprypin> actually it would be nice to have demo code and check its diffs when working on something
<oprypin> i mean code to generate documentation from
<oprypin> the methods don't need bodies
<straight-shoota> don't think that exists
<oprypin> mmm very interesting repository though
<straight-shoota> I've been working on a more properly designed structure
<straight-shoota> I need to update some things though
<oprypin> straight-shoota, oh man, we really gotta keep each other up to date on this stuff then :)
<straight-shoota> are you aware of https://github.com/crystal-lang/crystal/issues/6947
<oprypin> no
<oprypin> isnt it just a question of applying json::serializable
<oprypin> nvm just need to read the issue
<straight-shoota> just JSON::Serializable would be poor for an external API
<straight-shoota> the compilers internal data structures (ASTNodes etc.) are too much focused on code details and the decorators used by the docs generator are too much focused on HTML
<straight-shoota> export data needs something in between
<straight-shoota> abstracted enough but not specifc to HTML output generation
<FromGitter> <Blacksmoke16> anyone else getting achievements on the forums for things they didnt actually do?
<FromGitter> <Blacksmoke16> but i like never replied to that thread...
<straight-shoota> the only one who shared a link in that thread was vlazar
<straight-shoota> maybe you shared that link in a different thread and it got mixed together?
<FromGitter> <Blacksmoke16> isnt the first time it happened either, got one 10 days ago for https://forum.crystal-lang.org/t/utf8-issues-with-alpine-linux/888
<FromGitter> <Blacksmoke16> :shrug:
<straight-shoota> maybe post a bug report at https://meta.discourse.org/c/bug/1
<FromGitter> <Blacksmoke16> prob not a bad idea
<straight-shoota> it's prop hard to replicate
<straight-shoota> or in the forums meta category... maybe manas can ask the hoster for support
<straight-shoota> AFAIK this is SaaS
<FromGitter> <Blacksmoke16> πŸ‘ i can start there
<FromGitter> <Blacksmoke16> apparently im the only one with the `Devotee` badge 😎
<straight-shoota> congrats
<FromGitter> <j8r> @ImAHopelessDev_gitlab try Geany - cross platform, light :)
<straight-shoota> I've got aficionado. Not sure how I earned that
<FromGitter> <Blacksmoke16> wonder if theres some leniency, as im pretty sure i missed a day here and there
<straight-shoota> maybe
<FromGitter> <ImAHopelessDev_gitlab> i can't click the menu links on the top nav bar
<FromGitter> <watzon> Where?
<FromGitter> <ImAHopelessDev_gitlab> on forum lol
<FromGitter> <RespiteSage> @ImAHopelessDev_gitlab https://forum.crystal-lang.org/t/forum-navbar-non-clickable/2661
<FromGitter> <Blacksmoke16> when reading external docs, and the docs reference a type. Do you think its nice to have that type linked to the API docs. Or i guess what im really thinking is should *every* usage be linked, or is that a bit much?
<FromGitter> <Blacksmoke16> or maybe link the first usage in a paragraph/section, then just backtick the other ones?
<FromGitter> <ImAHopelessDev_gitlab> @RespiteSage i fixed it locally but basically fiddled around with dev tools and css properties. something to do with position: sticky and z-index
<FromGitter> <3n-k1> @Blacksmoke16 i know several times now i've seen a type i wanted info on and didn't know what module it was in
<FromGitter> <Blacksmoke16> fair enough, my as well just link them all then
<FromGitter> <Blacksmoke16> doesnt hurt anything
postmodern has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> rofl wow this bug
<FromGitter> <Blacksmoke16> Overflow?
<FromGitter> <ImAHopelessDev_gitlab> missing `l`
<FromGitter> <ImAHopelessDev_gitlab> i kept thinking why my monsters all had 0 HP, monster_level was going to `0` ROFL
<FromGitter> <Blacksmoke16> Hm?
<FromGitter> <Blacksmoke16> Ah
<FromGitter> <Blacksmoke16> What's with all the to_i calls
<FromGitter> <ImAHopelessDev_gitlab> when i was adding the new parameter `main_mob_ids`, i misclicked to add the comma and hit backspace, this removed the letter `l` from monster_level. no idea how that happened
<FromGitter> <ImAHopelessDev_gitlab> from an exported json file. it only happens once at startup, so no worries
<FromGitter> <ImAHopelessDev_gitlab> i just use json.parse as an abstraction layer so i can statically type my classes
<FromGitter> <ImAHopelessDev_gitlab> the exported json file is from adminer.php (which is connected to my local mysql db). so the output on some of the values is a PITA to deal with. that's why it looks messy
<FromGitter> <Blacksmoke16> Why not just use from json
<FromGitter> <ImAHopelessDev_gitlab> like, for example
<FromGitter> <Blacksmoke16> With the serializable module
<FromGitter> <ImAHopelessDev_gitlab> bcz too many ifs
<FromGitter> <Blacksmoke16> what?
<FromGitter> <Blacksmoke16> include a module, literally nothing else to do
<FromGitter> <ImAHopelessDev_gitlab> example, this field. it's an array of int32s. but it's exported as a string. so it needs to be converted to it, only if size > 0. or just 0 (int32) if the string is empty
<FromGitter> <Blacksmoke16> use a converter
<FromGitter> <ImAHopelessDev_gitlab> and if delimited by `;`, it has to be split by `;`, etc
<FromGitter> <ImAHopelessDev_gitlab> iuno i tried that before but raged
<FromGitter> <Blacksmoke16> but real question is, why are you storing an array of values separated by a `;`?
<FromGitter> <ImAHopelessDev_gitlab> because i edit all my game data in a database with adminer.php
<FromGitter> <Blacksmoke16> wouldnt it make more sense to use like a `JSON` column, or a mapping table or something?
<FromGitter> <ImAHopelessDev_gitlab> iuno
<FromGitter> <ImAHopelessDev_gitlab> i have a large Monsters hash that is used, when that monster id is read from the level
<FromGitter> <ImAHopelessDev_gitlab> so it maps,y es
<FromGitter> <ImAHopelessDev_gitlab> if main_monster = Monsters[monster_id]?
<FromGitter> <Blacksmoke16> mk
<FromGitter> <Blacksmoke16> i feel like most of your problems are self inflicted :p
<FromGitter> <ImAHopelessDev_gitlab> Example when a monster dies, i'll check it like this (https://paste.ee/p/Qdcy9), then call handle_quest_completion from here ⏎ ⏎ https://paste.ee/p/dXO27
<FromGitter> <Blacksmoke16> πŸ‘ for the comment
<FromGitter> <Blacksmoke16> wew, lot going on there
<FromGitter> <ImAHopelessDev_gitlab> `if a == 1` is now switched to enums btw, this is older code
<FromGitter> <Blacksmoke16> good good
<FromGitter> <ImAHopelessDev_gitlab> i now use enums for actions. much easier
<FromGitter> <Blacksmoke16> using exhaustive case as well?
<FromGitter> <ImAHopelessDev_gitlab> yah i bit the bullet on the lowercase thing
<FromGitter> <Blacksmoke16> exhaustive case
<FromGitter> <Blacksmoke16> using `in` instead of `when`
<FromGitter> <ImAHopelessDev_gitlab> oh i haven't
<FromGitter> <ImAHopelessDev_gitlab> i thought it was something else with enums and case
<FromGitter> <ImAHopelessDev_gitlab> @Blacksmoke16 want to cry? https://paste.ee/p/uPT2y
<FromGitter> <Blacksmoke16> iv'e seen worse. Lot going on but pretty readable