<FromGitter>
<watzon> It's easier in ruby because you can do `break if str.sub!` with all the items because `sub!` returns `nil` if nothing was substituted
snsei_ has quit [Remote host closed the connection]
<FromGitter>
<bararchy> @watzon do you even sleep? XD
<FromGitter>
<watzon> Nope
<FromGitter>
<watzon> Lol
<FromGitter>
<watzon> To the chagrin of my wife
<FromGitter>
<bararchy> HAHAHA
<FromGitter>
<watzon> But hey, the Crystal community is getting some good shards out of it
<FromGitter>
<watzon> :p
<FromGitter>
<bararchy> that's true, very helpful stuff TBH
<FromGitter>
<watzon> I'm mainly trying to fill gaps in the ecosystem. I know a language nowadays is only as good as it's ecosystem and I very much want Crystal to succeed
<mps>
watzon: agree fully
<mps>
I looked at some of your shards. Although I don't use them (yet) I like to have them in my 'back brain' to remember when time come I need them. thanks for your work
<FromGitter>
<watzon> No problem :) honestly I love just love contributing and creating things that are useful to people
<FromGitter>
<bararchy> @watzon How about a 0mq or rabbitMQ ? ;)
<FromGitter>
<watzon> Hmm I've never used either, but I could definitely have a look
<FromGitter>
<watzon> I *definitely* don't have too many projects
<jokke>
i'm one of those people that write stuff to write other stuff to write other stuff. "ok, works for me, moving on"
<FromGitter>
<watzon> Lol I suppose that's the good thing about open source, if you don't do it someone else always can
<jokke>
the documentation? :D
<FromGitter>
<watzon> Yup, or anything else for that matter
<jokke>
hah i wouldn't expect anyone to do that :D
<jokke>
docs are always the tedious part
<jokke>
and you already know how it works since you wrote it!
<jokke>
:D
<FromGitter>
<watzon> Haha I'm different than most people in that regard. I do DDD (documentation driven development) most of the time, so I typically work backwards, writing docs for features that don't exist yet and then implementing those features. It helps me thing about things from the user's point of view.
<jokke>
ok so no solution yet but should work with alpine 3.9
<jokke>
hm nope, not working with 3.9 either
<jokke>
but i'm installing crystal from edge repos
<FromGitter>
<mwlang> I'm having trouble rendering code examples in the README.md file. Works fine for when github.com shows the readme, but with crystal docs, content is lost along the way.
<FromGitter>
<mwlang> any idea what's happening here?
<jokke>
bye internet
<jokke>
always sounded like such a good idea to put everything behind a single centralized solution!
<FromGitter>
<mwlang> I thought you said cloudflare for a moment...
<jokke>
oh
<jokke>
i meant cloudflare
<jokke>
lol
<FromGitter>
<mwlang> and sadly, my sites are down. :-(
<jokke>
yeah...
<jokke>
well...
<FromGitter>
<mwlang> but yeah, I always worried about this day.
<jokke>
why..?
<FromGitter>
<mwlang> well, they do make it easy to mitigate DDoS attacks.
<jokke>
just make a static site :P
<jokke>
and how many ddos attacks have your sites received before cloudflare?
<FromGitter>
<mwlang> and my bigger customers have been big targets of DDoS over last few years.
<jokke>
oh ok for customers
<FromGitter>
<mwlang> me personally, none. I just have mine on cloudflare for testing.
<FromGitter>
<mwlang> but my customers...they get absolutely hammered at times.
<jokke>
hehe
<FromGitter>
<mwlang> and I reckon I better go check in on them and let 'em know what's up!
<jokke>
i get hammered some times too
<jokke>
on weekends
<FromGitter>
<mwlang> I'm guessing some devop fat thumbed a configuration setting somewhere...akin to Amazon's crash last year.
<jokke>
mmh
<FromGitter>
<mwlang> Let's find out which crypto-exchange has been hacked because pretty much all of them hide behind cloudflare.
<jokke>
:D
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<spTorin> @mwlang in your example ping is just get REST API from node
<FromGitter>
<mwlang> @spTorin actually, I need to update that example now that I look at it closely. Some of this copied from Ruby gem examples, which have obviously changed!
<FromGitter>
<mwlang> I was caught up in "why it's not rendering the docs" and not looking at what's written.
<FromGitter>
<mwlang> uhm...how do you write examples that work? In my case, I created an ./examples folder and the first example script there, ./examples/ping.cr: ⏎ ⏎ ```require "../src/binance" ⏎ ⏎ client = Binance::REST.new ⏎ puts client.ping.inspect``` ⏎ ⏎ And that leads to not being able load dependencies! "/binance/src/binance.cr💯 can't find file 'cossack'" (which is in the project's shard.yml
<FromGitter>
<watzon> I've never had a problem running examples that are in the `/examples` folder. Are you running them from your projects root or cding into the examples directory to run them?
<FromGitter>
<watzon> @mwlang ^
<FromGitter>
<mwlang> I'm in the examples folder.
<FromGitter>
<mwlang> but maybe it works better to do `crystal examples/ping.cr` instead of `cd examples && crystal ping.cr` ?
<FromGitter>
<watzon> That's your problem
<FromGitter>
<watzon> Exactly
<FromGitter>
<watzon> Otherwise each example should be its own shard with a `shard.yml` file that requires your project
<FromGitter>
<mwlang> hmmm...that didn't work either.
<FromGitter>
<watzon> What is the error you're getting?
<FromGitter>
<mwlang> ```crystal examples/ping.cr``` => Error in examples/ping.cr:1: while requiring "../src/binance" ... in src/binance.cr💯 can't find file 'cossack'
<FromGitter>
<watzon> You've run `shards install` I'm assuming?
<FromGitter>
<mwlang> yes.
<FromGitter>
<mwlang> I have the ./lib/cossack folder.
<FromGitter>
<mwlang> and specs work, of course.
<FromGitter>
<watzon> Hmm, weird
<FromGitter>
<mwlang> it's just that the examples aren't loading from the "../lib" folder.
<FromGitter>
<mwlang> so my "hack" was to symlink ../lib as ./examples/lib
<FromGitter>
<Blacksmoke16> are you sure you're paths are right?
<FromGitter>
<j8r> `rm -rf /` solves also any problem - no file, no OS, no more problem
<FromGitter>
<watzon> 😂 so true
laaron has joined #crystal-lang
<FromGitter>
<j8r> I've pushed an update to a compile-time safe CLI lib: https://github.com/j8r/clicr ⏎ What do you think? An issue I see is we can't dynamically modify the CLI at runtime, is there a usecase for this?
<FromGitter>
<j8r> Usually everything that is dynamic are command arguments and variables, not subcommands
<FromGitter>
<j8r> nor options
duane has quit [Ping timeout: 258 seconds]
duane has joined #crystal-lang
<FromGitter>
<mwlang> uhmmm...symlinking came as a result of things being FU'd. ;-)
<FromGitter>
<mwlang> I suspect it's because I tried a number of different shards along the way, modifying dependencies and development dependencies as I did so.
duane has quit [Ping timeout: 248 seconds]
<FromGitter>
<mwlang> so, removing the .lock file and shards install solved whatever mess I had created there.
<FromGitter>
<Blacksmoke16> or is that not possible...
<FromGitter>
<mwlang> @j8r when did that command change!? It used to be ```"format C:" ``` 😆
<FromGitter>
<mwlang> The sad thing is we used to give that command out to newbies coming onto BBS forums and asking dumb question, esp. after they curse the veterans out -- and more than a few were known to have follow it blindly.
<FromGitter>
<mwlang> how to inline HTML for crystal docs to render as-is?
duane has joined #crystal-lang
<FromGitter>
<Blacksmoke16> im assuming just putting html in the comment block doesnt work
<FromGitter>
<mwlang> that's correct
<FromGitter>
<pynixwang> how to pass c binding custom header
<FromGitter>
<pynixwang> @[Include] is not there
absolutejam1 has joined #crystal-lang
<absolutejam1>
anyone got a good resource (blog post or whatever) about Crystal's concurrency situation?
<absolutejam1>
I'm not sure I caught it last time I checked on the language and I'm super interested in picking it up
<absolutejam1>
I'm searching myself, but I'm just asking in case any body has posted something a thousand times to answer annoying questions (like this one)
<rkeene>
I think it's currently just cooperative multithreading within a single logical thread of execution
<FromGitter>
<watzon> rkeene has it right, there's currently no true multi-threading. Everything operates in a single thread with a stack of fibers.
<rkeene>
And, it is significant to know, within a single execution space -- in some languages you can have different address spaces between threads (of any type), but Crystal is a shared address space for its threads, which can sometimes matter
<absolutejam1>
that's what I just read, thanks. That's fine enough for my uses.
<absolutejam1>
Honestly, it's more to help my feeble brain not have to use async
<absolutejam1>
does go do full parallelism via. goroutines, or just concurrency?
<FromGitter>
<watzon> Pretty sure go has full parallelism support
<FromGitter>
<watzon> As does rust
<absolutejam1>
watzon: more just that i've never been able to handle it very well in most languages
<absolutejam1>
Think it takes a bit of a mental shift and I've never needed it in that way, and I don't try and touch js, like ever.
<rkeene>
Go supports pre-emptive multithreading, which -- on a system with multiple physical execution units -- can cause true concurrency
<rkeene>
The larger advantage is that the user doesn't have to define yield points, which is also the larger disadvantage when using a shared adress space :-D
<absolutejam1>
the reason I'm reaching for Crystal is because I'm writing a lot of Elixir and I'm kinda fed up of Python's rigidity. I've started writing a bit of Ruby instead of Python for those quick jobs and I love the syntax. I've tried go a few times but it's just too 'ugh' for what I need it for
<rkeene>
A good paper on this is Events vs. Threads by Ousterhout if you're interested
<absolutejam1>
I'll check it out
<FromGitter>
<watzon> Yeah python pretty much sucks
<rkeene>
If you're exploring stuff and want an interesting take on concurrency, I'd also recommend looking at Tcl for a more mature ecosystem. It's what I prefer for this kind of work, but Crystal has some other advantages.
<absolutejam1>
watzon: Python was great when I was learning it on the side because it has its fingers in every possible pie and it's quite easy to grok
<absolutejam1>
but it's just not very expressive. like, at all
<FromGitter>
<watzon> Yeah that's about the only good thing about it
<FromGitter>
<watzon> Lol
<rkeene>
Tcl does everything you could ever want, but nobody's ever heard of it :-D
<absolutejam1>
Yeah, I'm trying to stay away from some of the lesser known or esoteric languages
<absolutejam1>
ocaml looked hella interesting too, but Ruby-ish syntax is the most expressive I've found.
<rkeene>
absolutejam1, Tcl isn't exactly esoteric, many projects started out as Tcl stuff and branched out from there -- Redis was originally a Tcl script, SQLite was originally a Tcl extension, for examples off the top of my head
<absolutejam1>
the biggest problem I see is that go is still the standard for the likes of kubernetes, but I keep avoiding it as long as I can
<absolutejam1>
rkeene: that's interesting; I never knew that
<FromGitter>
<watzon> It's not a real encoding format, but there are several gems that I've seen use it and I don't know if something similar is already possible in Crystal
<FromGitter>
<watzon> Although I guess Crystal's strings are UTF-8 encoded only
<FromGitter>
<mwlang> I wouldn't say nobody's heard of Tcl. ;-) It was, after all the forerunner of many other of today's script languages.
<rkeene>
mwlang, Most people think it's no longer around even though it has gained features and become valuable for solving problems at a compounding rate
<FromGitter>
<mwlang> Well, that, I can believe...it's rarely mentioned in my social circles anymore...perhaps because I have more Ruby friends and that's more what we tend to talk about.
<FromGitter>
<mwlang> but I also don't see much published about it on Medium and other outlets either.
<FromGitter>
<j8r> this isn't really like go marshalling in fact
<FromGitter>
<j8r> more about out of the box serialization
<FromGitter>
<watzon> Exactly
<FromGitter>
<watzon> Exporting and importing binary representations of objects is what I'm going for
<FromGitter>
<j8r> ha ok
<FromGitter>
<Blacksmoke16> ah, so not json?
<FromGitter>
<watzon> I'd like to have it conditionally compatible with Ruby's Marshal too, so that Ruby objects can be exported from Ruby and imported into Crystal
<FromGitter>
<watzon> And vice -versa
<FromGitter>
<j8r> then yes, @waj has worked on it
<FromGitter>
<watzon> Looks like he hasn't worked on it in quite a while though
<FromGitter>
<mwlang> for me, I mostly need to serialize and deserialize to Redis
<FromGitter>
<mwlang> so I can do number crunching in Crystal and presentation in Ruby
<FromGitter>
<mwlang> so that pretty much means, I'm serializing as strings, not binary as Marshal does.
<FromGitter>
<Blacksmoke16> could your serialize to json then just write the bytes into redis
<FromGitter>
<mwlang> going from Ruby to Crystal and back, sounds pretty nifty, but would require fairly careful construction of classes/structs on both sides.
<FromGitter>
<mwlang> it's slightly more complex than needs to be only because I can deserialize what was Marshal dumped from Ruby side too.
<FromGitter>
<mwlang> in any event, works very, very well for me across the board.
<robacarp>
so the gist here is that crystal is doing some calculation but you're displaying it with rails or something?
<robacarp>
or are you running crystal as a background job processor or something?
absolutejam1 has quit [Ping timeout: 258 seconds]
absolutejam1 has joined #crystal-lang
absolutejam2 has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 272 seconds]
<FromGitter>
<mwlang> I'm gathering data from binance exchange, crunching numbers (RSI, Bollinger bands, etc.) and then displaying through Ruby on Rails app and specifically with Plot.ly charting.
<FromGitter>
<cfsamson> Does anyone know if it's possible to emit LLVM IR or ASM from the Crystal compiler?
<FromGitter>
<watzon> I know you can do inline assembly with the `asm` macro
<FromGitter>
<watzon> Idk about emitting bytecode though
<FromGitter>
<cfsamson> yep, but I want to see the code generated. Found a blog post about it though :)
<FromGitter>
<PlayLights_twitter> Hey guys, do you how to create a cast? I would like to cast an object from one class to another
<FromGitter>
<PlayLights_twitter> like `vehicule.as(car)`
<FromGitter>
<girng> asterite mentioned that crystal can output literal C code
<FromGitter>
<girng> i wish there was a crystal playground for that, would be very cool imo
<FromGitter>
<cfsamson> It wasnt difficult (bit I couldn't find it documented). Just add `--emit-llvm-ir`. Sounds a bit strange if Crystal can output C since it uses LLVM as a backend but maybe someone made a transpiler or something for Crystal? Or, I don't know, maybe there is something I don't know about :)