ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <fridgerator> ugh, sorry for not posting code, i posted the question then I had to leave
<FromGitter> <fridgerator> I think I figured out my issue
<FromGitter> <fridgerator> Now my issue is trying to get a string from a `LibC:Char*`
<travis-ci> crystal-lang/crystal#60f675c (master - Format: fix indentation after backslash newline (#5901)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/361411821
<DeBot> https://github.com/crystal-lang/crystal/pull/5901 (Format: fix indentation after backslash newline)
cremes has joined #crystal-lang
<travis-ci> crystal-lang/crystal#7eae5aa (master - Use LibCrystalMain.__crystal_main directly (#5899)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/361412306
<DeBot> https://github.com/crystal-lang/crystal/pull/5899 (Use LibCrystalMain.__crystal_main directly)
cremes has quit [Quit: cremes]
DTZUZU has quit [Quit: WeeChat 1.9]
<FromGitter> <fridgerator> Works the first few times in a loop, then starts outputting partial strings or part of a string and part of another string... which makes me think i'm not using `pointerof` correctly
cremes has joined #crystal-lang
<FromGitter> <fridgerator> and eventually a Invalid memory access
<FromGitter> <unn4m3d> There is
heaven31415 has joined #crystal-lang
<FromGitter> <bew> are you following a C example?
<FromGitter> <unn4m3d> maybe do sth like this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ac2d12f5f188ccc1523b0b0]
<FromGitter> <unn4m3d> nc_inq_attname takes a pointer to UInt8 array, not to a single Uint8
<FromGitter> <fridgerator> @bew yeah i'm trying to follow this cpp code somewhat : https://github.com/swillner/netcdf4-js
<FromGitter> <fridgerator> @unn4m3d thanks, i'll try that
<FromGitter> <fridgerator> I've never used C, so i'm coming in a little blind
stone_ has quit [Quit: Page closed]
cremes has quit [Quit: cremes]
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<FromGitter> <fridgerator> @unn4m3d yeah that works great, thank you!
<heaven31415> you are welcome
heaven31415 has quit [Ping timeout: 260 seconds]
<FromGitter> <fridgerator> is there an easy way to remove null values from a Byte array?
<FromGitter> <fridgerator> from a Slice I mean
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
<FromGitter> <unn4m3d> `.select(&.!=(0))`
<FromGitter> <unn4m3d> ?
<FromGitter> <unn4m3d> @fridgerator
<FromGitter> <fridgerator> that doesn't throw an error, but I cant pass it to the initializer of string anymore
<FromGitter> <fridgerator> it does if I add `.to_unsafe`
<FromGitter> <fridgerator> `name = String.new(buffer.select(&.!=(0)).to_unsafe)`
<FromGitter> <fridgerator> thanks for the help again!
<FromGitter> <elorest> Here's a shard I wrote to make MIT license compliance easy. ⏎ https://github.com/elorest/compiled_license
<FromGitter> <fridgerator> How can I get an array of ints out of a `LibC::Int*` ?
<FromGitter> <fridgerator> I'm trying this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ac2fda57c3a01610da02e30]
<FromGitter> <fridgerator> which is obviously not correct
<FromGitter> <elorest> I just tried a few things as well. No luck yet.
<FromGitter> <fridgerator> thanks!
<FromGitter> <elorest> Is this useful? https://carc.in/#/r/3tak
<FromGitter> <fridgerator> hrm i'm not sure
<FromGitter> <fridgerator> i'm not able to pass a pointer to the parameter
<FromGitter> <elorest> I can't really speak to the lib your wrapping and it's requirements but it seems like it might be the answer to your question? ⏎ ⏎ > How can I get an array of ints out of a LibC::Int*
<FromGitter> <fridgerator> this returns something: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ac301a2bb1018b37a520273]
<FromGitter> <fridgerator> `Slice[0, 3, -479767200]`
<FromGitter> <fridgerator> *shrugs*
<FromGitter> <elorest> Hmmm.
<FromGitter> <fridgerator> but I dont think its correct
<FromGitter> <elorest> yeah that negative number at the end doesn't seem write for srue
<FromGitter> <fridgerator> haha, yep
<FromGitter> <fridgerator> alright, actually I dont think its supposed to be an array
<FromGitter> <fridgerator> `dimension_ids` is 0, which i figured out is correct
<FromGitter> <fridgerator> then the next 2 are just `1` and `2`
<FromGitter> <bew> what are the types here? you usually don't need to put `pointerof` that much
<FromGitter> <fridgerator> and nc_file, where i've done most of the work: https://github.com/fridgerator/netcdfcr/blob/data_structures/src/netcdf/nc_file.cr
<FromGitter> <bew> I think you can write: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ac306217c3a01610da04a21]
<FromGitter> <fridgerator> thanks bew
leucos has quit [Ping timeout: 246 seconds]
<FromGitter> <bew> you're welcome :) does it work?
<FromGitter> <fridgerator> yep
<FromGitter> <fridgerator> 👍
<FromGitter> <bew> cool 👌
<FromGitter> <elorest> ✨
<FromGitter> <bew> @fridgerator what you're doing with the select looks weird, why do you need this?
<FromGitter> <faustinoaq> https://werner.github.io/crystal_on_steroids/Object.html#%E2%9D%A8%E2%95%AF%C2%B0%E2%96%A1%C2%B0%E2%9D%A9%E2%95%AF%EF%B8%B5%E2%94%BB%E2%94%81%E2%94%BB-class-method ⏎ ⏎ lol
That_Guy_Anon has joined #crystal-lang
t0nyaway is now known as t0nyandre
Groogy has quit [Disconnected by services]
Groogy_ is now known as Groogy
<Groogy> Morning! o/
Groogy2 has joined #crystal-lang
cyberarm has quit [Ping timeout: 248 seconds]
<FromGitter> <girng> is it possible to do select * on a query?
cyberarm has joined #crystal-lang
leucos has joined #crystal-lang
<FromGitter> <girng> akctually.. i just saw db.mapping. and since crystal is statically typed, alli have to do is list all my database stuff there. should work.
<FromGitter> <girng> thx the heavens for db.mapping macro...
That_Guy_Anon has quit [Remote host closed the connection]
cyberarm has quit [Ping timeout: 260 seconds]
cyberarm has joined #crystal-lang
alex`` has joined #crystal-lang
Papierkorb has joined #crystal-lang
Papierkorb has left #crystal-lang ["Konversation terminated!"]
<FromGitter> <bararchy> @faustinoaq what's crystal on steroids ?
<FromGitter> <bararchy> in the docs it looks like a bunch of uneeded addiotions XD
<FromGitter> <faustinoaq> @bararchy Looks like a learning project, the funny thing is this function `❨╯°□°❩╯︵┻━┻ # => Calm down, yo.`
<FromGitter> <bararchy> yeha :)
<FromGitter> <faustinoaq> I didn't know crystal can do that XD
leucos has quit [Quit: Ping timeout (120 seconds)]
alex`` has quit [Ping timeout: 248 seconds]
<wuehlmaus> hmm, i am trying to understand the scan method. it has confused me that it works different from ruby and the documentation is not clear, too: https://crystal-lang.org/api/0.24.1/StringScanner.html. It shows s.scan(/\w+/) => "This" when it only shows it when i use s.scan(/\w+/)[0][0]. Am i am the only person who gets confused by that?
<FromGitter> <ryankshah> Is there a way to get user input?
<wuehlmaus> of course it CAN be different from ruby, that's not my point. I just found the documentation to be missing
flaviodesousa has joined #crystal-lang
alex`` has joined #crystal-lang
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
shalmezad has joined #crystal-lang
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vxP95
<crystal-gh> crystal/master bb5bcd2 TSUYUSATO Kitsune: Colorize: abstract colors and support 8bit and true color (#5902)...
<wuehlmaus> RX14: is colorize your project or did you do some patches only. It's great and very handy, thank you!
<RX14> no i've never touched it
<RX14> ary created it but various people have contributed over the years
<travis-ci> crystal-lang/crystal#bb5bcd2 (master - Colorize: abstract colors and support 8bit and true color (#5902)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/361604513
<DeBot> https://github.com/crystal-lang/crystal/pull/5902 (Colorize: abstract colors and support 8bit and true color)
<RX14> I was just merging a PR by makenowjust
<wuehlmaus> it is just a joy to use, ah!
<FromGitter> <fridgerator> @bew its to remove the null values from the `Slice`
<FromGitter> <fridgerator> otherwise the string ends up looking like `latitude\u0000\u0000\u0000`
duane has joined #crystal-lang
ua has quit [Read error: Connection reset by peer]
<crystal-gh> [crystal] MakeNowJust opened pull request #5906: Pass an unhandled exception to at_exit block as second argument (master...feature/at-exit-pass-exception) https://git.io/vxPbb
<FromGitter> <fridgerator> I dont think its correct though, sometimes I get invalid memory access exceptions
heaven31415 has joined #crystal-lang
<heaven31415> hi
<FromGitter> <fridgerator> God I love crystal. After a lot of Node and Python lately, this is such a relief
<heaven31415> just remember to keep crystal alive
<heaven31415> tell your parents about, your friends and your neighbours
<heaven31415> it*
<heaven31415> tell everybody
<FromGitter> <fridgerator> 🔥
lhz has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 246 seconds]
<FromGitter> <CaDs> hahaha
<FromGitter> <CaDs> it is important indeed to remember to keep crystal alive
<FromGitter> <CaDs> specially in this periods of silence
<FromGitter> <meraxes_twitter> And, ya know, do this too. :) https://crystal-lang.org/sponsors/ (I did this past week!)
<FromGitter> <CaDs> @meraxes_twitter check the name on 9th position from the top ;)
<crystal-gh> [crystal] RX14 closed pull request #5166: Semantic: don't guess ivar type from argument after assigned (master...fix/crystal/not-guess-argument-type-after-assigned) https://git.io/vdxUC
<crystal-gh> [crystal] straight-shoota opened pull request #5908: Update documentation for NamedTupleLiteral#[] (master...patch-1) https://git.io/vxXJS
<FromGitter> <meraxes_twitter> @CaDs Oh I know! :) Just hope others do too. :D
woodruffw has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has quit [Changing host]
<travis-ci> crystal-lang/crystal#82caaf0 (master - Semantic: don't guess ivar type from argument after assigned (#5166)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/361661252
<DeBot> https://github.com/crystal-lang/crystal/pull/5166 (Semantic: don't guess ivar type from argument after assigned)
heaven31415 has quit [Ping timeout: 276 seconds]
melonMan has joined #crystal-lang
heaven31415 has joined #crystal-lang
woodruffw has quit [Ping timeout: 260 seconds]
<melonMan> how is the crystal code actually converted to machine code? is it first converted to LLVM assembly and then to machine code or what?
woodruffw has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has quit [Changing host]
<RX14> yes
<melonMan> oo ok i imagine it hard to convert all that to assembly
<crystal-gh> [crystal] MakeNowJust opened pull request #5909: Fix #5907 formatter bug (master...fix/crystal-format/5907) https://git.io/vxX3v
<melonMan> is there btw some way to view the converted llvm assembly?
<heaven31415> that is a nice question
<heaven31415> but do you mean IR by llvm assembly?
<melonMan> ah i found a way. its possible with the --emit flag
<melonMan> the converted assembly is extremely huge. even if you just compile an empty file
<FromGitter> <straight-shoota> even an empty file includes a lot of things from the standard library required for stream handling, fibers, gc etc.
<crystal-gh> [crystal] straight-shoota opened pull request #5910: Remove Object#=~ and Object#!~ (master...jm/feature/remove-Object-pattern-matcher) https://git.io/vxXWk
heaven31415 has quit [Ping timeout: 260 seconds]
heaven31415 has joined #crystal-lang
<FromGitter> <ryankshah> Can anyone provide me an example of how to use `abstract class` definitions? I.e. the abstract class has some `abstract def` methods which are inherited and added to in the child classes
That_Guy_Anon has joined #crystal-lang
moei has quit [Quit: Leaving...]
DTZUZU has joined #crystal-lang
heaven31415 has quit [Ping timeout: 256 seconds]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vxXg6
<crystal-gh> crystal/master 5056859 TSUYUSATO Kitsune: Pass an unhandled exception to at_exit block as second argument (#5906)...
<oprypin> ryankshah, combine the first and the last code block from https://crystal-lang.org/docs/syntax_and_semantics/virtual_and_abstract_types.html
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vxX2T
<crystal-gh> crystal/master ec423eb TSUYUSATO Kitsune: Fix #5907 formatter bug (#5909)...
<FromGitter> <ryankshah> @oprypin thanks! also, I am creating a shard. my main file path is `dir > projectname > projectname.cr` and I have a file `.. > projectname > struct > myclass.cr`
<FromGitter> <ryankshah> The my class file is defined as `module ProjectName .. class MyClass end .. end`
<FromGitter> <ryankshah> How can i access this in the spec for testing?
<FromGitter> <ryankshah> Thanks
<oprypin> ryankshah, require "../src/projectname.cr"; use ProjectName::MyClass
<FromGitter> <ryankshah> @oprypin here's the develop branch from my repo: https://github.com/ryankshah/crystal_graph/tree/develop - I'm getting the error `in spec/crystal_graph_spec.cr:5: undefined constant UndirectedGraph`
<oprypin> ryankshah, is CrystalGraph::UndirectedGraph.new
<FromGitter> <ryankshah> @oprypin i still get `in spec/crystal_graph_spec.cr:5: undefined constant CrystalGraph::UndirectedGraph`
<oprypin> crystal_graph/struct/... is never referenced
heaven31415 has joined #crystal-lang
<oprypin> also, '*' and spec_helper are to be avoided unless necessary
<FromGitter> <ryankshah> I thought it was referenced by crystal_graph.cr through `/crystal_graph/*`
<FromGitter> <ryankshah> ah
<oprypin> * is not recursive
<FromGitter> <ryankshah> How could I fix this up?
<oprypin> just require files when they're required
<FromGitter> <ryankshah> Is this just for the spec?
<FromGitter> <ryankshah> So correct me if I'm wrong, in `src/crystal_graph` i should be doing `require "./crystal_graph/struct/*"`?
<FromGitter> <ryankshah> or should I be doing every single `.cr` file as `./crystal_graph/struct/graph` etc.
<oprypin> ryankshah, first of all you dont need this subfolder
<oprypin> if it was me, this would have been 1 file until a different structure proves necessary
<FromGitter> <ryankshah> Removing the `struct` subfolder and moving the files into the `./crystal_graph` folder makes the test work
<travis-ci> crystal-lang/crystal#ec423eb (master - Fix #5907 formatter bug (#5909)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/361749676
<FromGitter> <ryankshah> @oprypin also another thing if you're still around
<FromGitter> <ryankshah> Looking back at the tree at my new push I added a new file `directed_graph.cr`
<FromGitter> <ryankshah> Its now throwing this error:
<FromGitter> <ryankshah> https://pastebin.com/8Nb19r9h
<oprypin> ryankshah, this file depends on something in the file graph.cr but never requires it
<oprypin> [19:53:31] <oprypin> just require files when they're required
<FromGitter> <ryankshah> So is this what you mean't by not using `*`?
<oprypin> not exactly but it's correlated
<FromGitter> <ryankshah> So how could I fix this?
<oprypin> require "./graph.cr"
<FromGitter> <ryankshah> inside each of the files that inherit graph?
t0nyandre is now known as t0nyaway
<oprypin> yes
<oprypin> it's very simple. when one file requires another file, you write `require "./another_file"` in it
<oprypin> find it annoying? well maybe you shouldnt have so many files
<FromGitter> <ryankshah> @oprypin xD thanks for the tips <3
commavir_ has joined #crystal-lang
omninonsense has joined #crystal-lang
commavir has quit [*.net *.split]
braidn[m] has quit [*.net *.split]
[spoiler] has quit [*.net *.split]
braidn[m] has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
That_Guy_Anon has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
duane has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
<FromGitter> <ryankshah> Hey guys! So I'm creating my shard and came across this error running the test (all the code and error is in gist) https://gist.github.com/ryankshah/bab31e2764ee8372d2fca354f88894f0
<FromGitter> <ryankshah> I inherit an abstract class with no `initialize` method, and then use `initialize` in the child, however an error is thrown saying the child requires 0 params when it *should* require 1 param
<FromGitter> <bew> Isn't it `BasicVertex.new "test"` that you want in your spec?
<FromGitter> <aisrael> Have you tried calling `super` in `BasicVertex#initialize`?
<FromGitter> <bew> Vertex is abstract, and it doesn't have an initialize
<FromGitter> <ryankshah> @bew bloody hell I'm so blind
<FromGitter> <ryankshah> @aisrael should I be calling super always?
<FromGitter> <bew> Weird that you get this error and not the one saying that you're trying to instantiate an abstract class..
<FromGitter> <aisrael> Oh yeah. Didn’t even see the typo in the spec.
<FromGitter> <ryankshah> @bew Yeah hence why I went through all this hassle posting a gist, otherwise I would have been straight on its ass
<FromGitter> <aisrael> @ryankshah I call `super` in general since if the the parent class is abstract, that usually means I have ivars in it that need to be initialized as well
<FromGitter> <ryankshah> I dont have any ivars (at the moment, not sure if I will) but is it still necessary practice to call `super`?
<FromGitter> <aisrael> In your case, I think you’re better off using a `module` (which doubles as an `interface` in Go or Java)
<FromGitter> <bew> If you don't need it, don't call it..
<FromGitter> <ryankshah> ^
<FromGitter> <aisrael> If an abstract class doesn’t even have Ivars, then why is it even a class?
<FromGitter> <ryankshah> I'm a fan of getting workable code before refactoring
<FromGitter> <ryankshah> Love to make life hard
<FromGitter> <ryankshah> Also, is there a way to index an element from a set? `Set[i]` doesn't work
<FromGitter> <aisrael> Hehehe. My point is that unlike in Ruby where a `module` is basically just a mixin (since no type checking), in Crystal I’ve discovered that a `module` is sufficient for type safety. It acts like an `interface` (in Java or Go, as mentioned)
<FromGitter> <ryankshah> @aisrael ahhh that actually makes better sense since I would need to be type safe
<FromGitter> <ryankshah> `Set.index(object)` returns the index, but is there something for the other way round?
<FromGitter> <ryankshah> I know I could do `Set.to_a[0]` but I feel that is inefficient
<FromGitter> <bew> There's no way. Can I ask why you're using a Set?
<FromGitter> <ryankshah> Graph data structures use a set of edges and a set of vertices. I feel it would be more efficient to use `.to_a` instead of checking if the element exists already when inserting to the array
That_Guy_Anon has quit [Quit: Leaving]
shalmezad has quit [Quit: Leaving]
duane has quit [Ping timeout: 264 seconds]
duane has joined #crystal-lang
melonMan has quit [Quit: Page closed]
OvermindDL1 has joined #crystal-lang
<OvermindDL1> I'm trying to run some diminutive/unrealistic benchmarks of a variety of web servers for through-put testing, and I'm having some issues with Crystal, specifically it is multi-core code (supposedly) with a variety of crystal web servers (amber/kemal/lucky/raze/router_cr), and yet all of them seem to only be single-core. Now they are multi-thread sure, they are spawning oh 16 threads or so each (16 native core
<OvermindDL1> system), but they only ever eat 1 CPU's worth of power where every other language is eating the full 16-core's worth of CPU just fine, what am I doing wrong? Code is at: https://github.com/tbrand/which_is_the_fastest/tree/master/crystal
moei has joined #crystal-lang
<RX14> hmm
<RX14> the name overminddl1 rings a bell from somewhere
<OvermindDL1> Hmm, unsure?
<heaven31415> I wanted to say that crystal is lacking parallelization support but I'm not sure whether that is the issue here :P
<OvermindDL1> Oh also: Crystal 0.24.2 [4f9ed8d03] (2018-03-08)
<OvermindDL1> Well it's definitely making threads, but it's acting like it has a Python-like GIL or something...
<RX14> OvermindDL1, yeah crystal doesn't do parallelism
<RX14> the threads are just from the GC
<OvermindDL1> Hrmm, these people have been lying to me then... ^.^;
<RX14> who?
<RX14> ok
<OvermindDL1> The tbrand repo
<heaven31415> people confuse two words
<RX14> crystal is concurrent but not parallel
<OvermindDL1> Yeah those are very different things
<RX14> the typical approach for http is just to run a process per core
<OvermindDL1> They even wrote their 'base' benchmarker in crystal (a simple timer... I wrote a new one wrapping `wrk`), and it cannot flood *any* of the native code servers...
<RX14> with SO_REUSEPORT
<OvermindDL1> All these benchmark servers in crystal need to be rewritten then...
<OvermindDL1> Thanks for the report, I bet they can do so. :-)
<RX14> honestly most benchmarks are badly done
<RX14> lol
<OvermindDL1> Extremely, but this repo entirely confirms that they are not realistic so it's mostly just a playground for many of us
<OvermindDL1> And it gives me a chance to write web servers in about 20 languages for the fun of it. ^.^
<RX14> lol
<heaven31415> how reliable is Crystal built-in benchmark?
<OvermindDL1> I was noticing... inconsistencies with their crystal benchmarker though, which is why I wrote one on top of `wrk`
<RX14> the Benchmark.ips?
<RX14> it's good
<heaven31415> yes
<RX14> yeah thats a good microbenchmark harness
<OvermindDL1> Benchmarking by timing 'other' apps via network sockets is... not that good though... ^.^;
<RX14> it needs a blackhole like jmh
<RX14> but the rest is great
<OvermindDL1> Which I keep yelling at them to fix... I think I finally convinced them to use `wrk` instead today...
<RX14> lol
<RX14> should always be using wrk
<OvermindDL1> Yeessssss
<RX14> why reinvent the whell
<OvermindDL1> I don't know *why* they wrote one in crystal
<RX14> wheel*
<OvermindDL1> Hell I wouldn't write one at all, exactly, don't re-invent the wheel
<RX14> because some people just like reinventing the wheel
<RX14> i'm surprised it can't keep *any* of the servers busy though
<OvermindDL1> Eh, it can be fun, but don't use it as the base of your entire benchmarking infrastructure... >.>
<OvermindDL1> RX14: It can't keep up with any of the 'native' code servers I said. ;-)
<RX14> a crystal HTTP client should be able to do a pretty good rare
<RX14> oh
<OvermindDL1> It can swamp python/node/etc... just fine
<RX14> like Go/Crystal/C/C++?
<OvermindDL1> But go/rust/c++ it can't touch
<OvermindDL1> Yeah
<RX14> ok
<RX14> honestly the only good benchmarks for crystal are the techempower ones
<OvermindDL1> I'm about to post my latest test when my server finishes running it...
<RX14> and even then the results are weirdly broken
<OvermindDL1> Techempower is a load of garbage
<RX14> how so?
<OvermindDL1> Like holy hell their code is *BAD* in most of their tests
<OvermindDL1> Like doing things the worst/slowest way possible
<OvermindDL1> I used to work on fixing it a couple years ago but I gave up...
<RX14> lol
<OvermindDL1> It was too overwhelmingly bad
<RX14> thats just because they're all user-contributed
<RX14> the crystal ones are good because I wrote them
<OvermindDL1> Really need a language expert to go over each thoguh
<OvermindDL1> though*
<RX14> yeah
<RX14> exactly
<RX14> which is why I did lol
<OvermindDL1> I guess I am for C++/OCaml/Erlang/Elixir, but not the others
<OvermindDL1> Heh
<RX14> so it's not that hard
<OvermindDL1> Ah true true
<OvermindDL1> Hmm, their crystal_amber test failed...
<OvermindDL1> > Environment file not found for ./config/environments/production (Amber::Exceptions::Environment)
<OvermindDL1> Oh nice, they didn't setup their benchmark right
<RX14> and there's people who will give you free server time for open source projects to benchmark and stuff
<OvermindDL1> <- is one
<OvermindDL1> I host about 80 different open source projects on my servers, have been for near 20 years now, it's fun
<RX14> sounds expensive
<dom96> Yeah, I got one of their beefy droplets and I kept them running for a couple of hours
<OvermindDL1> I've owned my own servers and lines, it runs me about $300/mn on average
<dom96> They apparently have "dedicated vCPUs"
<OvermindDL1> But I pay for it out of pocket, my job pays well enough
DTZUZO has joined #crystal-lang
<OvermindDL1> dom96: That.... what...
<dom96> Almost sounds like a contradiction :)
<OvermindDL1> Yeah... >.>
<RX14> OvermindDL1, oh you ring a bell from the minecraft community...
<OvermindDL1> ...yes, I ran MinecraftForge for about 5 years
<dom96> OvermindDL1: If you're willing to give some free server time I'd really appreciate it. I don't have time to work on it now, but I want to optimise my project as much as I can (https://github.com/dom96/httpbeast).
<RX14> yep thats it
<OvermindDL1> Lex drove us all away though, he's... not nice...
<RX14> lol
<RX14> minecraft politics in #crystal-lang
<OvermindDL1> dom96: Poke me on IRC on occasion and I'll see what I can do
<OvermindDL1> Heh
<OvermindDL1> I don't get recognized that often, I was a very behind-the-scenes coder in forge... ^.^;
<RX14> I helped with that NOVA stuff when 1.8 was happening and forge was chaing all that model stuff
<dom96> OvermindDL1: will do :)
<OvermindDL1> I left during the 1.7.10-1.8 transition period
<RX14> yeah
<OvermindDL1> It was too annoying, the only community I've ever said that about
<OvermindDL1> And I *love* programming and hosting such things
<RX14> yeah I didn't ever really get into minecraft modding
<RX14> just half my friends were mc modders at the time
<RX14> and I hung out on esper so you just
<RX14> hear it whether you like it or not lol
<heaven31415> i loved to play with industrial craft and computer craft
<OvermindDL1> Bottom comment at https://github.com/tbrand/which_is_the_fastest/issues/101 I just ran another set of tests using `wrk` if anyone is curious about some of the server tests
<OvermindDL1> I still host some MC mods, like https://gregtech.overminddl1.com/ (he refuses to get his own domain), GT6 is awesome
<OvermindDL1> And yep, I was in the esper chat a lot. ^.^
<dom96> OvermindDL1: No Nim? :\
<OvermindDL1> I don't have it installed yet
<OvermindDL1> Fresh server remember? ;-)
<OvermindDL1> Need to install nim, .net, java, etc...
<OvermindDL1> I need to PR an OCaml server too...
<RX14> I still need to try gregtech lol
<RX14> I think it'd annoy me
<OvermindDL1> GT6 is an entire rewrite, it's *nothing* like the old ones
<OvermindDL1> He's actively developing it, new version about every 2 days
<OvermindDL1> Still 1.7.10 though
<heaven31415> ohh, that is cool
<heaven31415> I just hate minecraft after seeing minetest
<OvermindDL1> He's been working on it for years
<OvermindDL1> MC code is *horrible*, it is the prime example of what *not* to do in almost all cases, it's amazingly bad. ^.^;
<OvermindDL1> And that's not just because of the obfuscator
<heaven31415> you cannot build an underground base in MC when you have 128 blocks below
<OvermindDL1> The coding 'styles' are just *bad*
<OvermindDL1> heaven31415: Terasology has infinite direction in all 6 directions. ;-)
<RX14> terasology is really cool
<heaven31415> but does it have technology?
<OvermindDL1> Terasology is just an engine, not a game, you install mods from the main menu
<OvermindDL1> And yes, some are
<heaven31415> I see
<OvermindDL1> Most mods are fairly simple though, but it is really easy to mod if you want to
<OvermindDL1> Josharies Survival (sp?) is what you want if you want tech
<heaven31415> In what language I write them?
<OvermindDL1> Terasology is written in Java, it's a pure ECS pattern (not EC)
<OvermindDL1> So Systems are written in Java, components are defined in Java but written in JSON
<Vexatos> "the name overminddl1 rings a bell from somewhere"
<OvermindDL1> You build a 'System' that defines functionality, components hold data, and json makes blocks/entities
<dom96> OvermindDL1: Do you run the HTTP servers and wrk on the same machine? I wonder if there are any best practices, I recall reading people saying that you should always have a separate server for the machine running 'wrk'.
<OvermindDL1> Vexatos: Oh hey!
<Vexatos> Oh hey!
<heaven31415> gonna check it, thanks dude
<OvermindDL1> dom96: I do but only because I'm testing, and the 'official' person does the same
<OvermindDL1> I have other servers on the same 1gb subnet that I will do 'real tests' with later
<RX14> lol yeah me and Vexatos hang out in a private channel on esper so your name was sure to ring a bell
<dom96> oh cool
<OvermindDL1> Lol
<RX14> also you probably host a maven repo somewhere
<Vexatos> RX14, last time I talked to him was... last week or so
<RX14> which I probably mirrored at one point
<RX14> lol
<RX14> small world
<OvermindDL1> I host a few maven repo's, GT6 is the largest by *far*
<Vexatos> yes because it is 15MB per file
<OvermindDL1> Used to host forge's maven, back when it actually ran well
<OvermindDL1> Heh, yep
<Vexatos> and an update a day
<RX14> I used to run mvn.rx14.co.uk which was a fairly big artifactory instance
<RX14> which cached like
<RX14> 15 different maven repos
<OvermindDL1> I still have forge's maven backed up around here somewhere from when I left...
<Vexatos> and then it died and broke gradle scripts all around the world
<OvermindDL1> It's *huge*, many many terabytes
<RX14> it was like 100GiB of jar files
<RX14> for my maven cache
<OvermindDL1> Heh
<RX14> OvermindDL1, i imagine it would compress pretty well as class files though
<RX14> since class files would be the same for a long run of builds
qard has joined #crystal-lang
<OvermindDL1> That is compressed. ;-)
<OvermindDL1> It's not just forge, I hosted a lot of mods on the forge maven as well
qard has quit [Read error: Connection reset by peer]
<RX14> yeah but OvermindDL1 you'd be compressing the jar files
<OvermindDL1> Which lex eventually wanted to kick off, but I didn't, one of the reasons I left, I want to *support* the community
qard has joined #crystal-lang
<RX14> which would be suboptimal
<OvermindDL1> Indeed it would yeah
<OvermindDL1> It's just the standard system dumps though
<OvermindDL1> And I'm not short on space (yet)
qard has quit [Read error: Connection reset by peer]
<RX14> but thats insane that the forge maven was many terabytes though
<RX14> I wouldn't have pegged it that big
<OvermindDL1> I hosted a *LOT* of other mods on forge, they tend to hold a lot of textures
<RX14> do you colo?
<OvermindDL1> colo?
<OvermindDL1> Colocate?
<RX14> where do you host all this
<RX14> yes
qard has joined #crystal-lang
<OvermindDL1> The forge server I hosted in canada and germany, but the rest of my servers are in california and texas
qard has quit [Read error: Connection reset by peer]
<RX14> so just rented dedicated servers?
<OvermindDL1> I try to choose locations on the L3 backbone so the latency stays low
<OvermindDL1> yes
<Vexatos> RX14, the secret sauce to all this is having a job that yields many coin
qard has joined #crystal-lang
<RX14> tfw no coin
<RX14> give job
<OvermindDL1> I host my *big* ones at home though, but they host no sites, it's just a CPU crunching
qard has quit [Read error: Connection reset by peer]
<OvermindDL1> I work for the government, the pay is... not great, but I don't spend money so all my spare goes to servers... ^.^;
<RX14> OvermindDL1, you rack at home or towers?
<OvermindDL1> rack
<RX14> nice
<Vexatos> RX14, I can give you a job but I can't pay you, will that work for you?
qard has joined #crystal-lang
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
<RX14> OvermindDL1, if you want me to look over any benchmark code i'd be happy to help
<OvermindDL1> All of the ones at https://github.com/tbrand/which_is_the_fastest/tree/master/crystal need an overhaul I guess if you want to fix them? Right now crystal performs *really* badly compared to almost all the other languages because they are ending up single-core
<OvermindDL1> Though since the benchmarker @tbrand wrote is written in crystal, you can't tell when you use that one, but using `wrk` it is *really* obvious
<OvermindDL1> I don't know crystal, like at all, it's still on my to-learn list... ^.^;
<OvermindDL1> I try to learn at minimum 3 languages a year, most recently it's been Rust as I see it as the first possible one to replace C++ for my C++ usages... eventually (it's not _quite_ there yet, but close)
<RX14> the gist of it is passing reuse_port: true to the `listen`
<RX14> and then just spawning nproc --all processes in a bash loop lol
<OvermindDL1> So basically like node. ^.^;
* OvermindDL1 really really hates node...
<RX14> yeah currently
<OvermindDL1> Is crystal planned to become fully concurrently parallel sometime?
<RX14> yeah
<RX14> I'm actually preferring not having to think about locking too much lol
<OvermindDL1> Nice, definitely so
<OvermindDL1> Lol
<OvermindDL1> I tend to either callbacks copying state in C++/Rust, or message passing on the BEAM for my multi-core code
<RX14> but yeah
<RX14> we'll have parallelism
<RX14> OvermindDL1, crystal uses CSP like go and erlang
<RX14> well
<OvermindDL1> Awesome
<RX14> unlike erlang that you still have shared memory
<OvermindDL1> Erlang actually uses segmented stacks, but yeah
<OvermindDL1> Erlang has shared memory with binaries of >64bytes in size
<RX14> it's like go where you can do shared memory with locks but you're encouraged to do channels
<OvermindDL1> Which can give you huge speed boosts if taken advantage of at times
<RX14> OvermindDL1, well the technical details aside erlang doesn't really expose shared memory between actors
<OvermindDL1> I personally ran into a lot of design limitations with the channel approach because of stackless python way way back when, so I'm not a fan of it in Go now (especially Go's horrid typing system), I quite prefer the BEAM's mailbox and link model
<RX14> erlang is functional right
<OvermindDL1> Well it is shared, just not mutable
<RX14> ok
<RX14> yeah
<OvermindDL1> In erlang it is encourages to know memory is shared, but it is all immutable
<RX14> my bad
<OvermindDL1> encouraged*
<RX14> I meant shared mutable memory
<RX14> in crystal you have no VM to tell you what to do lol
<RX14> you can do whatever you want with pointers
<RX14> although thats usually a bad idea
<OvermindDL1> Heh, taking a, oh, 100 byte slice of a 2 gig binary will keep that binary around on the BEAM, so you definitely have to know how the shared memory works... ^.^;
<OvermindDL1> Heh
<RX14> yeah, same in crystal
<OvermindDL1> I have to admit, I'm really a fan of the Rust ownership model, I've programmed the same way in C++ but just without the compiler checking it, Rust checking it is... frankly... awesome
<RX14> we use a conservative GC
<Vexatos> I only know Julia, where memory is not shared unless you explicitly declare it to be
<OvermindDL1> It's one of the first big 'language features' in over a decade that has really made me go "That's so obviously wonderful!"
<RX14> OvermindDL1, yeah I need to properly try rust
<OvermindDL1> I highly recommend it
<RX14> I havent tried rust or elixir yet
<RX14> i've just like
<OvermindDL1> It can't quite replace C++ yet, but it is getting really really close
<Vexatos> and everything else is done through virtual I/O between threads
<RX14> read a lot about them
<RX14> lol
<OvermindDL1> If you know erlang then you know Elixir, Elixir is just a new syntax on Erlang, + Lisp'y style macro's
<OvermindDL1> The macro's is what makes elixir
<RX14> but I think that rust and crystal are really orthogonal to each other
<OvermindDL1> And the tooling, elixir has great tooling
<RX14> in that i'd rather have a GC than rust
<RX14> if I can
<RX14> but sometimes you can't
<OvermindDL1> Eh, I'm not a fan of GC's, I've been burned way *way* too many times on pauses and such...
<Vexatos> a good coder
<Vexatos> I like aggressive GCs
<OvermindDL1> GC's manage memory yes? But they don't manage other resources like files or sockets, sure what 'does' manage those can be reclaimed eventually, but real-time is important on those. The Rust model basically takes C++'s RAII to an *extreme*, which handles *all* resources identically, not just memory
<OvermindDL1> Whether files, locks, messages, anything
<RX14> I still think rust's syntax is butt-ugly though lol
<dom96> You could get a GC to manage other resources too ;)
<OvermindDL1> You will *never* have a null pointer in safe rust code, or modify the same memory from two threads at the same time
<OvermindDL1> Rust's syntax *is* butt-ugly
<OvermindDL1> They took *way* too many haskell'isms... >.<
<RX14> not as bad as nim :P
<OvermindDL1> I want an OCaml syntax, with Rust's ownership system, and stages macro's
<OvermindDL1> Oh god that would be bliss
<OvermindDL1> staged*
<dom96> RX14: What's wrong with Nim's syntax? </3
<OvermindDL1> And throw in a dependently typed system to boot
<RX14> crystal's macros are ugly lol
* OvermindDL1 hasn't learned nim yet
<RX14> dom96, too many weird symbols
<OvermindDL1> Elixir macro's are beautiful, like it did them *well*, only lisp does them better
<RX14> like * to export
<dom96> sure beats Python's _ :P
<dom96> Which doesn't even mean anything to the interpreter
<Vexatos> Comparing languages to python is not a good approach
<RX14> I'm a great fan of ruby's syntax, if you hadn't already guessed
<dom96> How does Crystal handle exports?
<OvermindDL1> Aaand I'm off work, 'night
<RX14> def/private def/protected def
* OvermindDL1 really hates ruby's syntax
<dom96> OvermindDL1: YOu should check out Nim's macros
<OvermindDL1> Learn OCaml then tell me ruby has good syntax. ;-)
<RX14> I like the visual weight of ruby
<dom96> Even Rust is trying to implement them now ;)
<RX14> it's mostly wordy but with just enough symbols
<OvermindDL1> A function definition, fully typed and safe, is just something like: `let add a b = a + b`
<Vexatos> I like the way Julia does macros, it just fits neatly into the language itself
<heaven31415> so many languages, just like pokemons
<OvermindDL1> But yeah, I'm out. ^.^
<heaven31415> we gotta catch em all
<RX14> night
<dom96> RX14: There actually isn't that many symbols in Nim. It's far more wordy than most C-like languages.
<dom96> Perhaps not as wordy as ruby though
<RX14> dom96, why not change * to "public"
<RX14> too late?
<dom96> definitely
<RX14> should have done it 4 days ago
<dom96> Also, you make things public very often
<Vexatos> Nothing is "too late", see Python 2 vs 3, but then again, better not compare anything to python
<dom96> Typing 'public' every time would waste a lot of my life :P
<RX14> yeah
<RX14> most things in crystal are public
<RX14> and so we have public by default
<Vexatos> default public is kind of nice
<Vexatos> I wish Julia had that, but it can be fixed with a one-liner so whatever :P
<RX14> I don't really like the typing argument personally
<RX14> like, I don't spend my time typing when programming
<RX14> I spend it thinking and 8reading* code
<RX14> so thinking about the readability of code is 10x as important as the writability of code
<dom96> Then how come we're not all coding in Basic? :)
<RX14> because basic isn't readable :)
<RX14> it's really hard to read basic's control flow
<RX14> because of the lack of indent and the hunting for numbers
<dom96> Perhaps Visual Basic would be a better example
<dom96> That's how I started my programming journey
<RX14> same lol
<dom96> :D
* OvermindDL1 started in assembly... Talk about wordy...
<Vexatos> I don't even remember what my first language was
* OvermindDL1 is also driving so should not be here...
<RX14> then I went C#, then java, then literally everything
<heaven31415> what is the best language to start?
<dom96> I went to Python, then Haskell, then Nim
<Vexatos> depends on what you want
<RX14> that's not an answerable question heaven31415
<dom96> with some different languages in between briefly
<OvermindDL1> Assembly, you learn the actual computer first that way
<RX14> learning the computer isn't that useful
<OvermindDL1> I'm hard set on that
<heaven31415> I think so too, I think you shouldn't start from high level
<Vexatos> would you like a language with easy syntax, a generally useful language, a language that will be useful in the future, etc
<OvermindDL1> Not for the computer sakes no
<dom96> OvermindDL1: If I started assembly I never would have become a programmer
<RX14> the way my uni does it is haskell and C at the same time
<dom96> Actually, the first programming book I got was a C book
<dom96> "C in easy steps"
<OvermindDL1> But it's useful so you think about what you do in other languages
<RX14> you get taught C and haskell at the same time and it's great
<dom96> I was disappointed when I couldn't create a GUI in 5 seconds :P
<Vexatos> Reminds me of my uni where we were taught physical chemistry and quantum chemistry at the same time
<OvermindDL1> dom96: eh, LLVM addressing is pretty cool
<OvermindDL1> Assembly*
<RX14> the haskell teaches you logic and the C teaches you inperative programming
<Vexatos> dom96, the first programming book I got was "Programming in Lua" >_<
<OvermindDL1> Imperative sucks, honestly, and I'm a life long C++ programmer
<dom96> Imperative is love
<heaven31415> so you are raii guy xD?
<RX14> for an OO language devloper I remarkably hate OO
<dom96> Haskell was nice, but it always felt like I was fighting it every step of the way.
<RX14> lol
<OvermindDL1> Immutable when possibly and efficient for the purpose, screw OOP
<Vexatos> I always say that haskell is a language that should be taught to everyone but used by noone
<OvermindDL1> OCaml is so so so much better than Haskell...
<dom96> I avoid OOP whenever necessary :)
<heaven31415> why is that?
<OvermindDL1> It's like happen, but for actually getting real work done
<dom96> Vexatos: That's a good saying :)
<OvermindDL1> Haskell*
<OvermindDL1> Stupid phone
<Vexatos> pure functional languages don't get you far because you _are_ fighting the language itself along the way
<RX14> OvermindDL1, if you're driving stop using the phone
<Vexatos> They are an absolutely great proof of concept
<OvermindDL1> Vexatos: exactly
<Vexatos> and teach very important paradigms
<dom96> OvermindDL1: yeah, what RX14 said
<OvermindDL1> OCaml gives you escape hatches
<OvermindDL1> Lol
<Vexatos> but haskell is absolutely useless for real-world usage
<OvermindDL1> Yep
<RX14> maybe I should quit crystal and do rust or ocaml or something
<heaven31415> no
<dom96> Vexatos: I'd say there probably are some use cases where Haskell works well
<OvermindDL1> Do them all
<OvermindDL1> Link them all together, a frakenprogram
<Vexatos> It's like in chemistry where you are taught about quantum calculations but end up never doing them (unless you are me). Quantum mechanics are important to understand modern chemistry, but in reality, you only need a small part of it.
<RX14> I havent learned a new language since I learned crystal is my problem
<Vexatos> the same is about haskell, I feel
<RX14> and I need to change that
<RX14> actually I learnt haskell
<RX14> but that was at uni
<dom96> I got a Rust book recently
<RX14> so doesn't count
<dom96> Read one page
<dom96> Haven't had a chance to read more :)
<Vexatos> Learn Julia, OCaml and Nim, and make all of us happy :3
<dom96> Vexatos: \o
<heaven31415> how would you convince me on why I should learn Nim?
<OvermindDL1> Learn no less than 3 languages, well, per year
<Vexatos> I don't think Nim is a very good first language to learn
<heaven31415> well
<heaven31415> It wont be my first language
<RX14> I remember reading the nim documentation years ago and being disgusted by various things
<dom96> Yeah, I'd suggest Python, then Nim when you undoubtedly get annoyed by Python's shortcomings :)
<Vexatos> Please no python
<RX14> but I can't remember anything but the *
<dom96> Vexatos: What's wrong with Python?
<OvermindDL1> OCaml
<Vexatos> The only reason to ever learn python is the ecosystem, for everything else there are superior choices
<RX14> I don't like indent-based languages personally
<RX14> so that contributed
<Vexatos> dom96, an environment of scientific computing made me hate python
<heaven31415> what language is the best for finding job and paying bills?
<Vexatos> since 50% of software is written in it
<Vexatos> Java
<dom96> heaven31415: My favourite Nim features: best C++ interoperability short of C++ itself, soft real-time GC, the best macro system in an imperative language
<Vexatos> And there is no way around that
<RX14> heaven31415, any of the popular ones
<Vexatos> Java is the #1 most used language for moneys
<RX14> but thats not a question you should be seeking
<RX14> learn what you enjoy
<heaven31415> I did
<RX14> you'll be much better off in a job you enjoy
<RX14> not one you hate
<OvermindDL1> Common
<OvermindDL1> COBOL
<OvermindDL1> *
<Vexatos> dom96, how are nim macros superior to macros in other languages
<dom96> Vexatos: hm, that's a shame. It's a nice little language.
<OvermindDL1> Friggin phone
<RX14> OvermindDL1, i'll ban you if you keep using IRC while driving
<heaven31415> why?
<heaven31415> he is learning to multitask
<RX14> ...
<heaven31415> xD
<dom96> Vexatos: what other non-lispy languages have compile-time function evaluation + procedural AST-based macros?
duane has quit [Ping timeout: 260 seconds]
<Vexatos> dom96, Julia definitely has the former
<RX14> I havent seen nim's macros
<dom96> But you can't manipulate the AST directly at compile-time in Julia, can you?
<OvermindDL1> I'm home now if that helps? 😅
<Vexatos> you mean patch things into any part of it, not just attach stuff to the end?
<Vexatos> because you can definitely generate arbitrary Julia code inside a macro
<Vexatos> I have already done a few rather disgusting things with those in the past
<RX14> crystal macros are basically templating language
<RX14> it's weird
<RX14> I think quote/unquote macros might have been better idk
<RX14> there's many things about crystal that aren't perfect
<RX14> but I still love it for feeling like a dynamic language still
<Vexatos> dom96, regarding python: You learn to hate it as soon as you try to use it for scientific or technical computing, i.e. are forced to use numpy. You will immediately notice that the language wasn't made for it and wonder why you are forced to read this decade-old code. That is why I like Julia, it was made for it... The only other language good for scientific computing I am aware of is fortran
<Vexatos> and that one definitely shows its age by now
<dom96> The code will output "Hello World"
<RX14> dom96, wow thats ugly lol
<dom96> The comments show what `node` looks like
<dom96> RX14: Have you seen Rust's macros? lol
<Vexatos> I don't think you can replace AST nodes in Julia
<RX14> yeah my objection about that would be they would be absolutey unreadable without a DOM reference open
<RX14> DOM?
<RX14> ast.
<RX14> i need to sleep lol
<RX14> crystal's AST at least has... names
<RX14> instead of indexing
<Vexatos> well actually
<RX14> that would be node.args[0] = whatever in crystal
<RX14> but it's not
<RX14> because thats not how crystal macros work
<RX14> you get passed an immutable AST
<dom96> yeah, but I'm using the low-level API for this. We need someone to build something nicer on top :)
<RX14> and you produce plaintext
Thomas has joined #crystal-lang
<RX14> crystal's macros are uniquely easy to do simple shit in
Thomas is now known as Guest52294
<RX14> because you're just templating crystal sourcecode
<RX14> with a copy of the AST on hand
<dom96> Vexatos: regarding scientific Python, sure, I can agree that it's not the best. But that's not what I'd use it for anyway.
heaven31415 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<Guest52294> Is Crystal a reaonable choice for building a unix CLI? I'd like to build something similar to the git command line tools, however I can't seem to figure a way to get command line arguments
<RX14> at the end of the day there's never going to be a perfect proigramming language
<RX14> Guest52294, yes
<Vexatos> dom96, that does the same as your test code
<RX14> commandline arguments are in ARGV
<RX14> just a constant
<RX14> it's an array
<RX14> so like ARGV[0]
<RX14> Guest52294, ^
<dom96> Vexatos: Cool. Then maybe Nim isn't unique in this respect.
<dom96> It's a noteworthy feature nonetheless though
<Vexatos> dom96, granted, you can only modify the code the macro is given
<Vexatos> i.e. the expression or code block directly following it
<dom96> Can't you create new AST nodes?
<RX14> isn't quote/unquote really the best way to do this anyway?
<Guest52294> Thanks, I'll take a look at argv
<Vexatos> you can create new nodes of course
<Vexatos> a macro in Julia is just a function that takes an object of type Symbol or Expr and returns a Symbol or Expr
<Vexatos> and Expr can be any expression or code block
<Vexatos> any julia code, basically
<dom96> I can apparently just do `result[0][1] = quote: "Hello World"` in Nim too
<Vexatos> you can even parse() a String into an Expr
<dom96> I should add an 'args' accessor into the stdlib :)
<RX14> "apparently"
<Vexatos> so a macro can literally compile code, heh
<RX14> shouldn't you know?
<RX14> of all people?
DTZUZO has quit [Read error: Connection reset by peer]
<RX14> dom96, yeah that call being a list is unforgivable
<RX14> it should be .method and .args[0]
<dom96> RX14: heh sure. I've only ever used `quote` for long pieces of code so wasn't sure if this would also work.
<RX14> args, name, reciever
<dom96> If you're looking at the AST though, it's easy to know what index you're looking for
<RX14> so your macro system is reliant on code comments? :P
<Guest52294> RX14, would 'puts ARGV[1]' print the first argument, then?
<RX14> no
<RX14> ARGV[0]
<RX14> unconventionally
<Guest52294> oh, I thought that was the filename
<dom96> RX14: No, if you want you can easily define an `args`
<RX14> yeah in every other language
<Guest52294> oh
<Guest52294> ok
<FromGitter> <CaDs> Hello, probably this has been already asked but I couldn't find any reference so here it goes. ⏎ ⏎ I'm currently getting an error when running crystal docs ⏎ ↓↓↓ ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5ac40fcc7c3a01610da55a41]
<dom96> The fact that nobody bothered speaks to how relatively unimportant this feature is :)
<RX14> Guest52294, in crystal that's PROGRAM_NAME iirc
<Vexatos> RX14, actually in Lua it isn't, either
<RX14> dom96, can you show me an example of a larger more complex macro?
<RX14> Vexatos
<RX14> argv[2] right
<RX14> because lua is bad
<Vexatos> In Lua, arguments are passed to the current environment using the vararg ...
Guest52294 has left #crystal-lang [#crystal-lang]
<RX14> huh
<Vexatos> so you can do local firstarg, secondarg, thirdarg = ... or instead local args = {...}
<RX14> so you don't get argv[0]?
<Vexatos> and then args[1], args[2] etc
<RX14> what
<RX14> how do lua varargs work?!
<Vexatos> In Lua, any function can return as many values as it wants
<Vexatos> ... is such an unpacked set of variables
<Vexatos> so you can do local a, b, c = ...
<Vexatos> to assign the first three parts of ... to variables and drop the rest
<Vexatos> just like you can do local firstval, secondval = myfunction()
<Vexatos> if myfunction returns foo, bar
<Vexatos> You can pack those values in the same way
<RX14> dom96, that template thing looks cool
<Vexatos> local returnvals = {myfunction()}
<Vexatos> just like you can local args = {...}
<RX14> looks more like how crystal acros work
<dom96> RX14: The configurator? :)
<Vexatos> RX14, value passing in Lua is actually really powerful
<dom96> oh, you mean template--
<RX14> yes
<Vexatos> Lua itself is really powerful
<dom96> yeah
<Vexatos> given it has absolutely no existing stdlib
<RX14> huh
<dom96> Yeah, there are two levels in Nim. The templates which are declarative and allow you some limited substitution, like you can see there, and macros which are as powerful as you can get.
<RX14> so ... acts like a function call returning multiple values Vexatos?
<Vexatos> yup!
<RX14> dom96, yeah in crystal we just have the templates
<RX14> Vexatos, weird
<Vexatos> ... is just basically "many variables"
<RX14> why not call it argv
<Vexatos> it is pretty weird
<Vexatos> RX14, because it is also a function parameter
<Vexatos> you can do local function foobar(a, b, ...)
<RX14> it's too late for this shit
<Vexatos> to have a function accepting varargs
qard has joined #crystal-lang
<dom96> speaking of too late, I should head to sleep
<dom96> It was nice chatting with you all :)
<Vexatos> dom96, julia macros can become pretty ugly https://git.io/vx1qo
<Vexatos> heh, good night
<dom96> Vexatos: Maybe it's too late, but I cannot decipher that :)
<RX14> dom96, night
<RX14> i'll head to sleep too
<Vexatos> I don't think you should be able to
<OvermindDL1> Elixirs macros are AST transformers
<dom96> 'night
<RX14> after shine on you crazy diamond finishes of course lol
<OvermindDL1> And an AST node is just a 3-tuple
<Vexatos> I should go sleep too I guess, it's 0143 and tomorrow will have me talking about my thesis
<OvermindDL1> First element is the call, second is context data, third is arguments
<OvermindDL1> It's so stupid easy
<OvermindDL1> It has quote and unquote as well
<RX14> OvermindDL1, how does stuff like while loops work
<RX14> oh wait lol functional
<OvermindDL1> Elixirs is immutable, however the for function is very like a while
<OvermindDL1> And it's just like a function call internally
<OvermindDL1> Everything is like a function call internally
<OvermindDL1> Regardless of syntax
<OvermindDL1> It's so stupid easy
<RX14> yeah crystal doesn't have that
<RX14> we have a big OO ast node tree
<OvermindDL1> Even a value binding is just a function call in the AST
<OvermindDL1> OOP sucks
<RX14> :(
<RX14> I don't think OOP sucks
<RX14> I just think its another tool in the box
<RX14> not to be overused
<RX14> like people who write java do lol
<OvermindDL1> I do, and I can rent for literal hours as to why, don't start me. 😉
<RX14> there's actually little I think outright sucks
<OvermindDL1> Every programming style had areas where it is suited, sure you can shoehorn them elsewhere
<OvermindDL1> But OOP had so very little it is suited well to
<OvermindDL1> Has*
<RX14> why?
<OvermindDL1> Like if you want a strongly typed AST look at OCaml
<OvermindDL1> It has the only good looking compiler
<RX14> lol
<OvermindDL1> Like it's code is beautiful
<RX14> crystal's compiler is fucking terrible
<OvermindDL1> I'd NEVER say that about any other compiler
<OvermindDL1> OCaml has the most beautiful compiler code out
<OvermindDL1> And it's old too
<RX14> crystal's compiler has a hand-written lexer with 5 levels of `case` on the current character
<RX14> it's fun
<OvermindDL1> Also blazing fast, OCaml has the fastest native optimizing compiler of any language
<OvermindDL1> You really should learn it
<RX14> yeah I should
<OvermindDL1> Learn not only OCaml, but the compiler too. The compiler uses every ugly escape hatch possible for speed and it's still beautiful
<RX14> about how much code is the compiler?
<OvermindDL1> A lot, but well organized and easy to follow
<OvermindDL1> OCaml is written in OCaml
<OvermindDL1> Pluggable backends so it can compile to a lot of things, but default is native machine code at near C speed
<RX14> hmm
<OvermindDL1> OCaml has a GIL currently but in the process of being removed
<RX14> how does it do for concurrency
<OvermindDL1> See above
<RX14> gil on a compiled language :thonk:
<OvermindDL1> Eeeyup
<OvermindDL1> It's an ancient holdover
<RX14> thats not how it works?
<OvermindDL1> OCaml is fairly old
<RX14> does it ACTUALLY have a gil
<RX14> or no way to spawn threads
<RX14> OvermindDL1, single-thread can do concurrency
<RX14> just not parallelism
<OvermindDL1> Yes, it does have a global lock
<RX14> wow
<RX14> thats... weird
<OvermindDL1> It can spawn threads with ease though
<RX14> for a compiled language
<OvermindDL1> And yep weird
<RX14> ???
<RX14> ?????????
<OvermindDL1> But is being removed
<RX14> i can't imagine that codegen
<OvermindDL1> Hehe, go study it
<OvermindDL1> It has an interpreter too, native compiler, multiple JavaScript backends, a c backend, etc...
<RX14> OvermindDL1, so no concurrency/green threads :(
<OvermindDL1> Interpreter of bytecode and native is built in
<OvermindDL1> It slaves processes out currently, like Crystal
<RX14> no we don't
<RX14> we use an event loop with libevent
<OvermindDL1> It is getting green threads in the mcocaml update though, which is also what removes the gil
<RX14> and a stack switch written in assembly
<OvermindDL1> A full effects system
<RX14> we just mmap an 8MB stack per fiber
<OvermindDL1> This is can handle any concurrency style then
<OvermindDL1> Look up the upcoming Algebraic Effects system in OCaml, it's amazingly designed
<OvermindDL1> Thus*
<OvermindDL1> Friggin phone, blah
<RX14> hmm
<RX14> i should learn it
<RX14> but too little time
<RX14> too much work
<RX14> I'm spread too thin
<RX14> and I procrastinate too much
<OvermindDL1> Lol
<OvermindDL1> OCaml to JavaScript
<OvermindDL1> Compiled the compiler to JavaScript
<OvermindDL1> It runs in the browser there
<OvermindDL1> Compiled in real-time as you type
<RX14> i'm meant to be going to university, maintaining a programming language, and dealing with all the uni clubs and then a million other side projects but I always end up wasting time on reddit lol
<OvermindDL1> Hehe