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
Vexatos has joined #crystal-lang
<FromGitter> <HertzDevil> @BracketMaster superator doesn't support `:=` either
<FromGitter> <HertzDevil> according to their readme the only supported operators are ones that start with a built-in binary op followed by any number of unary ops
<FromGitter> <HertzDevil> this relies on the parser not choking up (crystal's already does on `--` for example)
mipmip has quit [Ping timeout: 265 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 260 seconds]
mipmip has joined #crystal-lang
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 252 seconds]
<FromGitter> <zomatree0:matrix.org> i feel like something isnt right here
<FromGitter> <zomatree0:matrix.org> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6084df47a2ac0d38e7d8724b]
<FromGitter> <zomatree0:matrix.org> ```Crystal 1.0.0 (2021-03-29) ⏎ ⏎ LLVM: 10.0.1 ⏎ Default target: x86_64-pc-linux-gnu``` [https://gitter.im/crystal-lang/crystal?at=6084e08506e2e024e8743d0f]
mipmip has quit [Ping timeout: 265 seconds]
deavmi has quit [Ping timeout: 260 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 252 seconds]
mipmip has joined #crystal-lang
<FromGitter> <naqvis> and what LLVM version you have installed on your box?
<FromGitter> <naqvis> `llvm-config --version`
DTZUZU has joined #crystal-lang
<FromGitter> <zomatree0:matrix.org> ah `11.1.0`
DTZUZU_ has quit [Ping timeout: 240 seconds]
<FromGitter> <zomatree0:matrix.org> shouldnt the output of `crystal --version` give the same version
mipmip has quit [Ping timeout: 240 seconds]
<FromGitter> <naqvis> no, that shows the version against which crystal compiler was built
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 240 seconds]
mipmip has joined #crystal-lang
deavmi has joined #crystal-lang
mipmip has quit [Ping timeout: 260 seconds]
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 252 seconds]
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 252 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 252 seconds]
<FromGitter> <rishavs> My crystal server is only responding back with text while I want it to respond with json. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ not sure what I am doing wrong here [https://gitter.im/crystal-lang/crystal?at=608520efc60826673bc37d94]
<FromGitter> <naqvis> its because `response_with_status` clears up all settings and writes the given status and message. Actually this method overwrites the `content_type` to `"text/plain"`
<FromGitter> <naqvis> so you better go with `print` or some similar methods
hendursa1 has joined #crystal-lang
mipmip has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
mipmip has quit [Ping timeout: 252 seconds]
mipmip has joined #crystal-lang
<FromGitter> <rishavs> Thanks @naqvis > If I use print, I instead get ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This is the issue I am getting from the browser dev tools. ... [https://gitter.im/crystal-lang/crystal?at=6085271eb9e6de24d657c25d]
<FromGitter> <rishavs> I could have sworn that this piece of code used to work, when I wrote it 2 years ago :/
<FromGitter> <rishavs> This is my js code; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60852768969f8b38ee9cf582]
mipmip has quit [Ping timeout: 252 seconds]
mipmip has joined #crystal-lang
_ht has joined #crystal-lang
mipmip has quit [Ping timeout: 240 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 252 seconds]
mipmip has joined #crystal-lang
ua has quit [Excess Flood]
ua has joined #crystal-lang
devoid_ has joined #crystal-lang
<devoid_> Heh all. I've played enough with crystal for it to be my new favourite language, but I'm struggling to find best practices for structuring real projects. Module setup, class inheritence vs includes etc. Can anyone recomend resources to look at, or a well structured project to copy from? Thanks!
<FromGitter> <oprypin:matrix.org> devoid_, first specify if it's application vs library, and the approximate domain that this project is in
<devoid_> FromGitter thanks, this is just a linux command line application, it reads a file and parses it into whatever data subtypes it recognises inside the file. In other languages I would have a base parser class, and subclasses to recognise specific data types. Is this the right approach for crystal? Also looking for guidance on how to use modules in this type of program.
<FromGitter> <naqvis> @rishavs might be something off somewhere, you can try to `curl` and then feed that response to `jq` to validate that server is returning JSON document
<FromGitter> <rishavs> Thanks Ali. Took me a lot of hours but I managed to find the issue. Its with the no-cors mode in fetch. ⏎ https://stackoverflow.com/questions/40182785/why-fetch-return-a-response-with-status-0 ⏎ ⏎ Cors is killing me :/ [https://gitter.im/crystal-lang/crystal?at=6085553ddc24646812e1bf6e]
<FromGitter> <naqvis> for example ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60855557a9dd556843fd3900]
<FromGitter> <naqvis> aah, CORS :P
<FromGitter> <oprypin:matrix.org> devoid_, modules in Crystal are just something that you realize it makes sense when it makes sense. oh I need to point out, when thinking of modules, I assume you mean it in the sense "something that can be included into a class". for that, certainly don't think too much about it, probably don't need it initially, because this feature is something that all other languages live fine without. but
<FromGitter> ... then there's also an almost entirely separate use of modules - just as namespaces. yeah, sure, just put your whole application into one namespace and move on. namespaces have no relation to the file structure that you use. basically separating things into files has almost no rules to how it's done
<FromGitter> <oprypin:matrix.org> i guess this is an ok example of application structure https://github.com/crystal-lang/shards/tree/master/src
<FromGitter> <oprypin:matrix.org> you may notice that almost every file starts with `module Shards`
<FromGitter> <oprypin:matrix.org> https://github.com/Blacksmoke16/oq/tree/master/src is also an example
<devoid_> FromGitter, ahh sweet. So that clears modules up. I'll look at shards. Thanks for your help. I really love crystal so far, just need to use it in a real application to get a proper understanding of it.
<FromGitter> devoid_, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<devoid_> oprypin, oprypin:matrix.org, thank you. oq looks like a similar setup to my app. (sorry, not sure how to properly tag humans through this bridge)
mipmip has quit [Ping timeout: 252 seconds]
<FromGitter> <oprypin:matrix.org> tag by prepending `@`. for me that's @oprypin:matrix.org - but most people don't have the matrix suffix. and np.
<devoid_> @oprypin:matrix.org, thank you. I have my code skeleton compiling properly now. Just have to make it work!
<FromGitter> <rishavs> How do I check if my api responses are being compressed? ⏎ I have just added the `HTTP::CompressHandler.new,` handler to my server but not sure how I can check if it is working
<FromGitter> <oprypin:matrix.org> @rishavs: are you using nginx? it can handle compression
<FromGitter> <oprypin:matrix.org> @rishavs: how to check: `curl -v -H 'Accept-encoding: gzip' $url`
<FromGitter> <rishavs> Cool. So if I use a reverse proxy like nginx or traefic, i don't need to use this handler at all?
<FromGitter> <oprypin:matrix.org> ye
<FromGitter> <oprypin:matrix.org> @rishavs: here's my setup, i never even thought about compression, but turns out it works
<FromGitter> <oprypin:matrix.org> `curl -v -H 'Accept-encoding: gzip' 'https://nightly.link/'`
<FromGitter> <rishavs> Thank you! this helps a lot!
<FromGitter> <oprypin:matrix.org> @rishavs: more snippets from my config ⏎ `http { gzip on; } ` ` server { listen 443 ssl; listen [::]:443 ssl; server_name nightly.link; location / { proxy_pass http://localhost:3098; } }`
<FromGitter> <oprypin:matrix.org> nginx config, that is
<FromGitter> <rishavs> ❤️
devoid_ has quit [Quit: WeeChat 3.1]
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 246 seconds]
<FromGitter> <oprypin:matrix.org> ☝️ Edit (https://gitter.im/crystal-lang/crystal?at=608577dcb9e6de24d658716a): @rishavs: more snippets from my config ⏎ `http { gzip on; server { listen 443 ssl; listen [::]:443 ssl; server_name nightly.link; location / { proxy_pass http://localhost:3098; } }`
<FromGitter> <rishavs> Thank you again Oleh
<FromGitter> <oprypin> no problem! ⏎ oops the edit wasn't supposed to be so loud
<FromGitter> <Groogy> Yo, do I need to do a special require to be able to use BigDecimal?
<FromGitter> <tenebrousedge> require "big"
<FromGitter> <Groogy> ah thx
<FromGitter> <Groogy> was trying various different combinations :D
<FromGitter> <tenebrousedge> :plus1:
<FromGitter> <Groogy> now to start replacing a lot of floats
<FromGitter> <tenebrousedge> what's the context, out of curiousity?
<FromGitter> <Groogy> Mitigating floating point errors for my game, both for predictions & networking later on
<FromGitter> <tenebrousedge> how significant are the errors?
<FromGitter> <Groogy> Quite, as it's essentially body simulations in space. Like the actual bodies don't get too off track but their paths that it's trying to display is just wobbling/shaking the further into the future I am looking because of the composition over time of a lot of smaller errors.
<FromGitter> <Groogy> So could have only the rendering do it to make it look nice but figured I might as well as preventive measure for networking later when I get to that
<FromGitter> <tenebrousedge> you're simulating gravity?
<FromGitter> <Groogy> Yeah I've focused on relativistic mechanics and having it be able to render the "past". I.e if the light of an event takes 5 minutes to travel to you, you won't see it until after 5 minutes.
<FromGitter> <RespiteSage> That's very, very cool. Are you propagating gravity that way, too?
<FromGitter> <Groogy> No, need to take some short cuts :P
<FromGitter> <tenebrousedge> isn't the 3-body problem inherently chaotic?
<FromGitter> <Groogy> Or well I guess indirectly? The gravity's effect on objects still follows this. But it's not like gravity's effect on space is properly modeled
<FromGitter> <RespiteSage> Yeah, that's what I meant. It would be wild to simulate the effect on space, because wouldn't that also effect both the trajectories and the timing of arriving light?
<FromGitter> <Groogy> @tenebrousedge yeah? I am not trying to make an actual physics simulation though, just fun mechanics to play with, with the delay of information being the main mechanic
<FromGitter> <Groogy> @RespiteSage yepp hence why I haven't given that much thought
<FromGitter> <tenebrousedge> well so the future-instability is inevitable, right?
<FromGitter> <Groogy> No that's not what I am having a problem with, I am having a problem with floating point errors compounding and that makes path prediction wobble when rendered. It doesn't need to be accurate, it just needs to be accurate enough for a player to interact with.
<FromGitter> <Groogy> Huh BigDecimal::ZERO is a BigInt
<FromGitter> <tenebrousedge> apparently. Doesn't look like there's a constant for `0.0`
<FromGitter> <Groogy> Thought it would be a copy paste error but BigInt doesn't have a ZERO constant so might be intentional?
<FromGitter> <tenebrousedge> maybe mention it here (https://github.com/crystal-lang/crystal/issues/10641)
<FromGitter> <tenebrousedge> it looks like `Big` is just generally problematic
<FromGitter> <Groogy> ugh luckily I am doing things with an alias so I can replace it later
<yxhuvud> why do the error compound so much? I mean, you have lots of decimals when using doubles. the relative error of some part of the calculation would have to be huge if resulting error is noticeable.
<FromGitter> <Groogy> ¯\_(ツ)_/¯
<FromGitter> <Groogy> We do it in Paradox games as well to avoid clients from going out of sync with the host in multiplayer games as an example
<FromGitter> <tenebrousedge> you work for Paradox?
<FromGitter> <Groogy> Yeh I'm game designer for eu4
<FromGitter> <tenebrousedge> Neat
<FromGitter> <Groogy> I might replace it with not being BigDecimal later and just do a naive implementation that suits specifically my needs later, but just now I wanna see if swapping out the Float64's gets me the result I want.
avane_ has joined #crystal-lang
<FromGitter> <galvertez> is there a way for a macro to determine the type of a variable in a case like ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=6085b09fb9e6de24d658f3b7]
avane has quit [Ping timeout: 240 seconds]
avane_ is now known as avane
<FromGitter> <galvertez> i'd prefer not to have branching at runtime
<FromGitter> <tenebrousedge> I mean yes, but what does not branching get you?
<FromGitter> <tenebrousedge> if the magnitude of the expected performance difference is extremely small, it's probably not worth complicating your code
<FromGitter> <galvertez> probably nothing for what i'm doing here since it's sequential anyway
<FromGitter> <galvertez> i just hate brute force checking if something is an array no matter what, since i expect most things to not be an array
<FromGitter> <Blacksmoke16> Use a dedicated array overload?
<FromGitter> <tenebrousedge> that occurred to me, but perhaps they're iterating over like `Array(Array | Int)`
<FromGitter> <galvertez> yeah as i was reading what kaia said i was thinking "i'm probably doing this totally wrong"
<FromGitter> <Blacksmoke16> Got some example code?
<FromGitter> <galvertez> for what i'm doing... eh it's possible somebody would use a union like that, but it would be weird
<FromGitter> <galvertez> i don't really anticipate a scenario like that
<FromGitter> <galvertez> i have some example code but i actually think it would confuse you guys more. the idea here is i am trying to make binary serialization that works more or less the way we have json/yaml serialization, so that somebody could just go `include Binary::Serializable` and not need anything beyond that
<FromGitter> <galvertez> and while i like https://github.com/spider-gazelle/bindata but it seems to require more hand holding than i think it should so i'm just seeing if i can do something that looks and feels a bit more like stdlib
<FromGitter> <galvertez> to that end, i think the correct thing is to do what's done here https://github.com/crystal-lang/crystal/blob/master/src/json/to_json.cr
<FromGitter> <Blacksmoke16> probably yes
<FromGitter> <galvertez> but with a `to_io(IO, IO::ByteFormat)`
<FromGitter> <galvertez> instead of `to_json`
DTZUZU has quit [Read error: Connection reset by peer]
hendursa1 has quit [Ping timeout: 240 seconds]
DTZUZU has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
_ht has quit [Remote host closed the connection]
postmodern has joined #crystal-lang
<FromGitter> <erdnaxeli:cervoi.se> Hi, I am trying to cross-compile for a raspberry pi 3 without success. I used the "nightly" docker image as I saw that this issue was recently resolved : https://github.com/crystal-lang/crystal/issues/3839 ⏎ but 1) the `cc` command still adds a reference to libcrystal.a 2) I got the following error "undefined reference to `setup_sigfault_handler'" when running it on the raspberry pi (without
<FromGitter> ... libcrystal.a
<FromGitter> <oprypin:matrix.org> erdnaxeli (https://matrix.to/#/@erdnaxeli:cervoi.se): which guide are you followign
<FromGitter> <oprypin:matrix.org> those arent really guides
<FromGitter> <erdnaxeli:cervoi.se> the weird think is that crystal nightly that should not use libcrystal.a anymore seems to still references it
<FromGitter> <erdnaxeli:cervoi.se> anyway it works with libcrystal.a
<FromGitter> <erdnaxeli:cervoi.se> thanks :)
<straight-shoota> Unfortunately, the current nightly build is a month old and doesn't contain the change which removed libcrystal
<FromGitter> <jrei:matrix.org> if I where your I'd compile in a docker image using qemu
<FromGitter> <jrei:matrix.org> here is a gist, a bit old now: https://gist.github.com/j8r/34f1a344336901960c787517b5b6d616
<FromGitter> <erdnaxeli:cervoi.se> ah, the nightly is not nightly 😅
<FromGitter> <erdnaxeli:cervoi.se> j8r (https://matrix.to/#/@jrei:matrix.org): nice! But default raspberry OS are 32 bits…
<FromGitter> <jrei:matrix.org> still?
<FromGitter> <jrei:matrix.org> I thought they moved to 64
<FromGitter> <erdnaxeli:cervoi.se> yes, I think they want to maintien compatibility on all rapsberry (even the 1)?
<FromGitter> <jrei:matrix.org> usually I prefer Armbian anyway
<FromGitter> <erdnaxeli:cervoi.se> anyway it tooks me a while but I managed to build a docker image with my crystal program for armv6 32 bits, and two have both arch (amd64 and armv6) available under the "latest" tag, so everything is fine
<FromGitter> <riffraff169> so have some data in some yaml files...but, want to be able to distribute this as one binary rather than an installation tree....not a big program, just some static data...any suggestions on best way to store the data within the program?
<FromGitter> <riffraff169> array of structs? or hashes...or classes with that data?
<FromGitter> <riffraff169> and how to load it? static, or like stored in a yaml string then loaded within the program...that seems a little roundabout though
<straight-shoota> do you need the data as YAML? Or does it map to an existing data structure?
<FromGitter> <riffraff169> almost all of the data is basically an array of items (hash or array), that ive added a key (corresponding to one of the array/hash items) to make it easier to reference specific entries, so converted into a hash
<FromGitter> <riffraff169> i hope i didnt overcomplicate the explanation
<FromGitter> <riffraff169> item 1 is ("name", value, value, value, value)
<FromGitter> <riffraff169> etc
<FromGitter> <riffraff169> was originally an array and searched, i added a key of the name so searching will be built in with the hash
<FromGitter> <riffraff169> so: "name" => (value,value,value,value)
<FromGitter> <riffraff169> and array of those
<FromGitter> <riffraff169> thats it, several of those, more like a database table i would suppose
<FromGitter> <riffraff169> but dont really want anything external to the binary
<FromGitter> <riffraff169> it is all static data, never changes, program reads a file, calculates information based on the tables, and spits out some results, then exits
<FromGitter> <riffraff169> so having db overkill, and nobody will want to go through all that just to run this program...
<FromGitter> <Daniel-Worrall> You can read it in at compile time as a macro, either as the file string itself or as a data structure native to crystal
<FromGitter> <tenebrousedge> just like a hash constant I guess
<FromGitter> <Daniel-Worrall> So you could have the yaml's data embedded into the binary and read the yaml at runtime, or parse the yaml into a cr format
<FromGitter> <riffraff169> i was thinking of doing that, that would be easy to convert the data that is currently yaml
<FromGitter> <tenebrousedge> may as well use a crystal structure and skip parsing at runtime
<FromGitter> <Daniel-Worrall> yes
<FromGitter> <riffraff169> but then i was thinking that i would have to have a bit of programming logic to convert YAML::Any to specific data type, so maybe store it in the correct format to begin with
<FromGitter> <riffraff169> so a hash of structs
<FromGitter> <Daniel-Worrall> Are the yaml key/values predictable?
<FromGitter> <riffraff169> what would be the best way (or correct way in case im thinking incorrectly) of initializing a struct with static data?
<FromGitter> <riffraff169> yes, basically like a database table
<FromGitter> <riffraff169> several tables, but each table has specific structure
<FromGitter> <riffraff169> a struct is perfect...so `a << MyStruct.new(some,data,here)` ?
<FromGitter> <Blacksmoke16> is an array the right choice. Like will you want to lookup a specific struct based on a key/id?
<FromGitter> <Daniel-Worrall> On the topic of parsing the yaml at compile time, you could use a run macro that runs a parse_yaml.cr that outputs the struct data you want.
<FromGitter> <Daniel-Worrall> https://crystal-lang.org/api/1.0.0/Crystal/Macros.html#run(filename,*args):MacroId-instance-method
<FromGitter> <Daniel-Worrall> Though I'm not sure if the NOTE about compiler caching will mean that changes to the yaml file won't be propegated 🤔
<FromGitter> <riffraff169> well, presumably nobody would recompile it except me....my audience, if running linux, may not be programmers or anything, just want to run programs
<FromGitter> <riffraff169> so a static binary is what i want
<FromGitter> <riffraff169> dog walking, be back in a few
<FromGitter> <oprypin:matrix.org> @riffraff169: literally write a program that consists of `puts "CONST = #{YAML.parse(xxx)}"` and macro run that
<FromGitter> <riffraff169> thats an idea...hmm
<FromGitter> <oprypin:matrix.org> @Daniel-Worrall: no it should be fine. we're talking about changes that are runtime from the perspective of the compiletime program but the warning is about compiletime of compiletime
<FromGitter> <oprypin:matrix.org> @riffraff169: if you want to involve structs, you can get even weirder with it. indeed go ahead with defining the full arsenal of YAML::Serializable types and then ... define their `inspect` in a way that prints source code..... and stick to the plan as above
<FromGitter> <oprypin:matrix.org> `def inspect; " #{self.class}.new(#{field1.inspect},....)"
<FromGitter> <Daniel-Worrall> Ah yeah then that works as expected
<FromGitter> <lbarasti> Hi folks, I stumbled upon what seems to be a bug (https://play.crystal-lang.org/#/r/azea) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6085f4f181866c680c46c5f5]
<FromGitter> <lbarasti> `Int32` also suffers from this, whereas `Float*` and custom classes don't seem to
<FromGitter> <riffraff169> ah man, thats interesting, but way more involved for some data that hasnt changed in years and probably wont for years more....just values for calculations....ill probably just create a constant hash of structs and initialize with the data
<FromGitter> <riffraff169> weird:
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6085fadbae90f36840a2da99]
<FromGitter> <riffraff169> this error:
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6085fb0bd7953918617dddc4]
<FromGitter> <riffraff169> stupid, i see it now...typo
<FromGitter> <riffraff169> man
<FromGitter> <tenebrousedge> I like giving hashes like that an alias, eg `alias ActivityMap = Hash(String, Activity)`
<FromGitter> <riffraff169> i should do that...still, same error even when correcting the typo...it is initialized though, so not sure
<FromGitter> <tenebrousedge> you may also want to do like `getter(foo : Foobar) { Foobar.new }`
<FromGitter> <tenebrousedge> use the block form of `getter` for lazy initialization
<FromGitter> <Blacksmoke16> Can you share the code and error after fixing the typo?
<FromGitter> <riffraff169> sure, let put a minimal in play
<FromGitter> <riffraff169> https://play.crystal-lang.org/#/r/azeh
<FromGitter> <riffraff169> probably something simple, like i didnt at least initialize it to empty set first before adding with `<<`
<FromGitter> <Blacksmoke16> i see 3 things wrong with this
<FromGitter> <riffraff169> im sure...still learning proper crystal programming
<FromGitter> <Blacksmoke16> `getter activities : ActivityMap` doesnt initialize the hash to anything, so you're using it before its initialized ⏎ ⏎ `"VS":` the `:` makes it a `NamedTuple` not a Hash ⏎ ⏎ `Hash` doesn't have a `<<` method [https://gitter.im/crystal-lang/crystal?at=6086003d81866c680c46daa2]
<FromGitter> <riffraff169> ok, so just `@activities["VS"] = ....`
<FromGitter> <riffraff169> and `"VS" => ...`
<FromGitter> <Blacksmoke16> right, also `Activity` doesn't have an initializer either, maybe look into https://crystal-lang.org/api/master/toplevel.html#record(name,*properties)-macro
<FromGitter> <tenebrousedge> `record` is great
<FromGitter> <riffraff169> does a record have to be defined all on one line? some of mine will have like 10 fields, so each field on a separate line would look cleaner
<FromGitter> <tenebrousedge> you can split it into multiple lines
<FromGitter> <tenebrousedge> also you can define methods if you need to, including initializers
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/azf0
<FromGitter> <Blacksmoke16> of course doing this is the initializer would rerun this logic any time this type is newed up, idk if thats impt or not for your use case
<FromGitter> <tenebrousedge> using a constant for your data is probably a good idea
<FromGitter> <riffraff169> no, the program is basically run once, loads all tables, reads an input file, calculates information based on the input file and the tables, prints out the results and exits....even if an input file has say 100 entries, impact will be minimal...
<FromGitter> <riffraff169> constants is fine too....
<FromGitter> <tenebrousedge> what exactly does this program do?
<FromGitter> <riffraff169> for this play by mail game im playing....takes warrior information, stats, descriptions,...and calculates skill levels and other stuff based on that....