<FromGitter>
<watzon:matrix.org> Ahhh now I get some of the initial confusion on structure
<FromGitter>
<rymiel:rymiel.space> I found it surprising how... *exciting* reading that reference book at https://crystal-lang.org/reference/syntax_and_semantics/ was for the first time. I had no exposure with Ruby at the time and while I know the Crystal syntax is heavily inspired from Ruby, i just found it incredibly refreshing to see all the things that were possible with sugar in Crystal. At this point I don't think i can ever go
<FromGitter>
... back to a different syntax.
<FromGitter>
<rymiel:rymiel.space> a gitbook better than most novels
<FromGitter>
<watzon:matrix.org> Hint: running `crystal init lib [project name]` will initialize the basic structure of a crystal library
<FromGitter>
<watzon:matrix.org> Emilia (https://matrix.to/#/@rymiel:rymiel.space): agreed. The gitbook is very informative. Another great resource is https://forum.crystal-lang.org. I learn new things all the time just by browsing recent posts.
<FromGitter>
<watzon:matrix.org> @js
<FromGitter>
<js:nil.im> I intentionally didn't do that yet since I wanted to learn about one thing after another, rather than have lot of boilerplate π
<straight-shoota>
> a gitbook better than most novels
<straight-shoota>
wow
<straight-shoota>
must be reading crappy novels, then xD
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #crystal-lang
<straight-shoota>
but great that you find the read refreshing, @rymiel
<FromGitter>
<js:nil.im> ok, got parsing of `/etc/hosts` and `/etc/resolv.conf` done now. And it's 2:30 am. Time to call it a day. And nobody has complained about anything but not using `crystal init`, so apparently not that terrible π
<FromGitter>
<js:nil.im> and tomorrow I gotta figure out how to read the registry on Windows π
<FromGitter>
<jrei:matrix.org> Unsupported by the company which made it
<FromGitter>
<jrei:matrix.org> May be fun to do, but this won't be very useful...
sz0_ has joined #crystal-lang
sz0 has quit [*.net *.split]
r0bby has quit [*.net *.split]
sz0_ is now known as sz0
r0bby has joined #crystal-lang
DeBot has quit [Ping timeout: 272 seconds]
jhass has quit [Ping timeout: 240 seconds]
straight-shoota has quit [Ping timeout: 272 seconds]
asterite has quit [Ping timeout: 276 seconds]
r0bby has quit [Ping timeout: 258 seconds]
r0bby has joined #crystal-lang
straight-shoota has joined #crystal-lang
jhass has joined #crystal-lang
asterite has joined #crystal-lang
deavmi has quit [Remote host closed the connection]
deavmi has joined #crystal-lang
HumanG33k has quit [Read error: Connection reset by peer]
HumanG33k has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #crystal-lang
_ht has joined #crystal-lang
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
alexherbo2 has joined #crystal-lang
johnny101 has joined #crystal-lang
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 268 seconds]
<frojnd>
What would be the nicest way to add to an verse_arr = Array(String) another array of string arr["foo", "bar"] I was hoping verse_arr << arr.flatten would work but I guess it doesn't Woul like to avoid looping over arr of strings if there is already made function
Flipez has joined #crystal-lang
<frojnd>
I mean I can always do it in 2 lines verses_arr << arr.first; verses_arr << arr.last
<FromGitter>
<Luj8n> Also, is this the place to ask these kind of questions?
<FromGitter>
<js:nil.im> Luj8n (Luj8n): Iβm new to the language myself and you got me curios. Thereβs a preview_mt compile time flag being checked in the code. Googling for that, I found this: https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html
<FromGitter>
<Luj8n> hm
<repo>
hi! I ran into this issue: `Missing hash key: "id" (KeyError)`
<frojnd>
Do I have to select table first (sqlite3) I get no such tabale. First I open DB and then `db.exec "insert into contacts values (?, ?)", "John Doe", 30` but I get no such table I created table with sqlite3browser
<frojnd>
Argh I had wrong db
alexherbo22 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo22 has quit [Client Quit]
alexherbo2 has joined #crystal-lang
<frojnd>
Ok so I did my_array.to_s to save array as a text into sqlite3 Now my string looks like this when I query DB: `"[\"foo\", \"bar\"]"` how can I convert it back to an array in crystal?
<FromGitter>
<Blacksmoke16> save it as JSON then parse it after reading it?
alexherbo26 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo26 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter>
<wyhaines> Yeah. If you are wanting to save an array into a SQLite varchar field, your best bet is to save it in a serializable format like JSON.
alexherbo2 has quit [Ping timeout: 245 seconds]
<frojnd>
Ok,.. make json inside crystal and save thta json as varchar to sqlite3...
<frojnd>
Did I understand that correctly?
<FromGitter>
<Blacksmoke16> right
sagax has joined #crystal-lang
andremedeiros has quit [*.net *.split]
woodruffw has quit [Ping timeout: 264 seconds]
woodruffw has joined #crystal-lang
andremedeiros has joined #crystal-lang
aquijoule__ has quit [Ping timeout: 256 seconds]
<FromGitter>
<alexherbo2> @Blacksmoke16 should the lock file be stored?
<FromGitter>
<Blacksmoke16> not really? As i think you'd be distributing a binary. If someone wants to build from source they can just install and build
<straight-shoota>
If you intend users to run `shards install` in your project to get reproducible dependencies, you should include a lockfile.
<FromGitter>
<oprypin:matrix.org> if you have a binary, you must add shard lock.
<FromGitter>
<Blacksmoke16> if ofc the binary actually has deps, which `shell-escape` doesnt
<FromGitter>
<asterite> Wouldn't specs be considered a binary? It would be bad to come back to the project two months later and find that it doesn't compile anymore...
<straight-shoota>
yeah, technically true
<straight-shoota>
but for specs it's not that relevant IMO
<straight-shoota>
ofc checking in a shard.lock is not disallowed for lib shards
richbridger has joined #crystal-lang
bazaar has joined #crystal-lang
<FromGitter>
<oprypin:matrix.org> @asterite: i prefer installing always-latest and running schedule
_ht has quit [Remote host closed the connection]
<FromGitter>
<oprypin:matrix.org> and if i'm a library, well, it would actually be *better* "to come back to the project two months later and find that it doesn't compile anymore", otherwise users of the library will find out first :)
ua_ has quit [*.net *.split]
fifr has quit [*.net *.split]
xybre has quit [*.net *.split]
Welog has quit [*.net *.split]
Vexatos has quit [*.net *.split]
markmarkmark has quit [*.net *.split]
olbat has quit [*.net *.split]
Welog has joined #crystal-lang
ua_ has joined #crystal-lang
fifr has joined #crystal-lang
Vexatos has joined #crystal-lang
olbat has joined #crystal-lang
markmarkmark has joined #crystal-lang
xybre has joined #crystal-lang
<FromGitter>
<asterite> Hehe, good point
duane has quit [Ping timeout: 240 seconds]
<FromGitter>
<js:nil.im> Does Shards only support Git?
<FromGitter>
<Blacksmoke16> can also use a path, but yea `git` is the main way outside of local dev
<FromGitter>
<js:nil.im> hmm, damn. I have all my stuff in Fossil instead of Git π
<FromGitter>
<Blacksmoke16> TIL there are people that dont use git π
<FromGitter>
<js:nil.im> I used to, until GitHub became shitty and I no longer trusted them with bugs, wiki, etc., so I was looking for something self-hosted where you can also clone the bugs etc. - and found Fossil and migrated to it
<FromGitter>
<js:nil.im> there's a git export, though
<FromGitter>
<js:nil.im> so it's not that big of a deal
<straight-shoota>
there's actually a PR pending to add mercurial support
<straight-shoota>
it's not that much to do. I suppose fossil shouldn't be difficult either.
<straight-shoota>
But you're one very few people using that :P
<FromGitter>
<js:nil.im> yep, there isn't many people using Fossil - I don't know why. I guess because it came much later than Git and Mercurial π
<FromGitter>
<Blacksmoke16> to be fair could have still used git. Also have likt gitlab and bitbucket :shrug:
<FromGitter>
<js:nil.im> well, neither of those *clone* the bugs and wiki etc
<FromGitter>
<js:nil.im> I kinda liked being able to clone everything
<FromGitter>
<js:nil.im> I can commit, then comment and resolve a bug - all offline. And then push it when back online.
<FromGitter>
<Blacksmoke16> ah fair enough
<FromGitter>
<js:nil.im> and it's super easy to set up for self-hosting. It's a single binary that can do scgi π
<FromGitter>
<js:nil.im> and getting the same web interface locally, I only need to run `fossil ui` and have all the same things π
<FromGitter>
<js:nil.im> qq: if I have def foo(x : Array(String)), why can't I do foo([])?
<FromGitter>
<Blacksmoke16> the type of the array needs to be known
<FromGitter>
<Blacksmoke16> `foo [] of String` or `foo Array(String).new`
<FromGitter>
<js:nil.im> but it can get it from the def foo?
<FromGitter>
<Blacksmoke16> iirc there was an issue about that?
<FromGitter>
<js:nil.im> why does it not infer it?
<straight-shoota>
the compiler could theoretically infer it from the signature
<straight-shoota>
but it doesn't (yet)
<FromGitter>
<js:nil.im> I mean, it gives a helping error message, but that does not explain why it does not infer π
<FromGitter>
<js:nil.im> so just a matter of not implemented yet?
<straight-shoota>
probably
<straight-shoota>
autocasting is relatively new addition addition to the language
<straight-shoota>
works with number literals and enums
<FromGitter>
<Blacksmoke16> (most of the time)
<FromGitter>
<js:nil.im> btw, is @@ just private instead of protected?
<FromGitter>
<js:nil.im> just saw that in some code