<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>
<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>
<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
<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>
<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
<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
<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> 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>
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>
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
<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.
<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.
<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
<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