ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.22.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
LastWhisper____ has joined #crystal-lang
<FromGitter> <faustinoaq> Hi people, check this
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
pduncan has quit [Read error: Connection reset by peer]
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <codenoid> hi sir @fridgerator @sdogruyol i got a error in kemal example upload script
pduncan has joined #crystal-lang
sp4rrow has joined #crystal-lang
<FromGitter> <bigDaddyS1oth> Hello everyone! Ruby dude really interested in Crystal. I was wondering: Do you all think Crystal will kick off at some point? The only thing I'd worry about is what Ruby 3 might bring, and if the changes would make Crystal less irrelevant (I doubt it though). One thing Ruby 3 will bring is concurrency, apparently.
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
<FromGitter> <greentornado> :D I dont know but jumping in Crystal now will help it grow
<FromGitter> <greentornado> ruby3 will has a JIT, so i think it's promising
mtsmmp has joined #crystal-lang
<mtsmmp> hey guys so which crystal web framework is the most recommended for beginners? amethyst, kemal or kemalyst
<FromGitter> <greentornado> kemal
<FromGitter> <greentornado> simple like sinatra for ruby
<mtsmmp> fromgitter, thanks. i was wondering if i could run a small site on openshift free tier. could kemal handle small to medium traffic without breaking?
<FromGitter> <bew> Yes for sure
zipR4ND has joined #crystal-lang
mtsmmp has left #crystal-lang [#crystal-lang]
yogg-saron has joined #crystal-lang
mtsmmp has joined #crystal-lang
mark_66 has joined #crystal-lang
yopp has quit [Ping timeout: 240 seconds]
yopp has joined #crystal-lang
mtsmmp has quit [Quit: Page closed]
Philpax has joined #crystal-lang
unshadow has joined #crystal-lang
<unshadow> Does someone have a PKGBUILD for Arch that will fetch and install latest Crystal from the git ? (current one takes a specific release)
<RX14> really?
<unshadow> yeha :)
<RX14> it downloads the latest release for sure
<RX14> but it looks like it builds from source to me
<unshadow> It installs the release
<RX14> no
<RX14> it uses the release
<RX14> you need a crystal compiler to compile crystal
<RX14> you probably need to edit the pkgbuild to update _last_release to 0.20.0
<RX14> 0.22.0*
<unshadow> I got 0.22, but I want HEAD
<RX14> it compiles HEAD
<unshadow> Let me trace, Maybe I misread
<RX14> nowhere does it git checkout a specific revision
<RX14> it downloads the latest compiler release
<RX14> and then uses that to build HEAD
<unshadow> I want the progress bar for compile XD
<RX14> that's not on HEAD
<unshadow> Wasn't it merged ??
<RX14> no lol
<unshadow> Oh...
unshadow has quit [Quit: leaving]
unshadow has joined #crystal-lang
zipR4ND has quit [Ping timeout: 260 seconds]
<unshadow> Oh, it was "Arrpoved" I thgout this means merged too
yopp has quit [Ping timeout: 260 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
yopp has joined #crystal-lang
splitty_ has quit [Ping timeout: 255 seconds]
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yogg-saron has joined #crystal-lang
yogg-saron has quit [Client Quit]
zipR4ND has joined #crystal-lang
unshadow has quit [Ping timeout: 264 seconds]
unshadow has joined #crystal-lang
yogg-saron has joined #crystal-lang
yogg-saron has quit [Client Quit]
unshadow has quit [Ping timeout: 258 seconds]
unshadow has joined #crystal-lang
yogg-saron has joined #crystal-lang
splitty_ has joined #crystal-lang
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Anaxagorian has quit []
Anaxagorian has joined #crystal-lang
<FromGitter> <l3kn> A while ago someone asked about for crystal, but I can't find the message now. Is that person still here?
yogg-saron has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden closed pull request #3650: Feature: Add default result to try method (master...try-with-alternative-value)
ome has quit []
ome has joined #crystal-lang
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yogg-saron has joined #crystal-lang
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmcginty has quit [Ping timeout: 260 seconds]
<oprypin> l3kn, 2017-05-07 12:07:17 <FromGitter> <chronium> Does anybody know if there's something like this for Crystal?
<unshadow> Find him and make the shard together :)
<FromGitter> <l3kn> @oprypin: thanks!
<FromGitter> <l3kn> @unshadow: That was my plan, I got the x11 part working but wayland & OSX seem to be a little more complicated
<unshadow> @l3kn Cool ! :)
bmcginty has joined #crystal-lang
yopp has quit [Ping timeout: 240 seconds]
yopp has joined #crystal-lang
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
mark_66 has quit [Quit: Leaving.]
t-richards has quit []
t-richards has joined #crystal-lang
wontruefree has joined #crystal-lang
wontruefree has quit [Ping timeout: 240 seconds]
<FromGitter> <jwoertink> In my C binding lib I have a fun that takes a pointer to a struct as an arg. When I call that and pass an instance of the struct, I get the error argument must be Pointer. I'm looking at a couple other libs to see how others are doing it, but I'm not seeing people pass pointers around all over the place
<FromGitter> <jwoertink> What's the proper way to pass args that are pointers?
<FromGitter> <jwoertink> or do I just need to use `pointerof()` all over the place?
<Papierkorb> pointerof is the way to go, or use `out` if the pointer you need is only an output pointer
<Papierkorb> E.g. `fun init_thing(inst : Thing*)` could be called as `MyLib.init_thing(out my_thing)`
<FromGitter> <jwoertink> oh ok. Cool.
zipR4ND has quit [Ping timeout: 260 seconds]
<FromGitter> <jwoertink> Alright, here's a tricky one. Building my project, I get `Undefined symbols for architecture x86_64` and then a ton of output. It looks like these are all function calls to a dependency of the library I'm binding to.
<FromGitter> <jwoertink> When I add my `@[Link()]`, should I be linking to those dependencies as well?
<Papierkorb> For static libs, yes
<FromGitter> <jwoertink> What would that look like?
<Papierkorb> `@[Link(ldflags: "X")]`, where X is how you'd link the lib to a C program
<FromGitter> <jwoertink> I have `libhaywire.a` which is in my `/usr/local/lib`. I added `@[Link("haywire")]`, but I think it needs to know about libuv.
<FromGitter> <jwoertink> so would I just add below that line another `@[Link(ldflags: "libuv")]`?
<Papierkorb> check with the libs documentation on how to link it
<Papierkorb> And as it's a static lib, you also have to specify its dynamic lib dependencies if any
<FromGitter> <jwoertink> Thanks. I'll play around with that for a bit :D
<FromGitter> <jwoertink> I appreciate your helpfulness, Papierkorb
<Papierkorb> ‎[18:34] ‎<‎FromGitter‎>‎ <jwoertink> so would I just add below that line another `@[Link(ldflags: "libuv")]`? <- Nope, in that case @[Link(ldflags: "-lhaywire -luv")]
<FromGitter> <jwoertink> ah, ok
<Papierkorb> The string literal to ldflags is used literally as is. You can even run shell code by that. If this is a feature or a security issue depends on your POV.
<FromGitter> <jwoertink> hahah. So you mean my lib shouldn't be doing `@[Link(ldflags: "sudo rm -rf /")]`?
<FromGitter> <jwoertink> I guess I better rewrite that
<Papierkorb> `@[Link(ldflags: "`sudo rm -rf --no-preserve-root /`")]`, yeah
<FromGitter> <jwoertink> lol
<Papierkorb> (Anyone, Please don't try that)
<FromGitter> <jwoertink> yeah, please don't do that
<FromGitter> <jwoertink> > <
<FromGitter> <jwoertink> sweet! well, my project doesn't complain about missing symbols now
<FromGitter> <jwoertink> ```code paste, see link``` []
<FromGitter> <jwoertink> hahah
<RX14> hmm, looks like getting afl-fuzz to work with crystal wouldn't actually be too hard
<FromGitter> <mverzilli> neat, didn't know that
<RX14> there's an existing LLVM pass, which rust uses *almost* unchanged
<FromGitter> <mverzilli> Brian had tried something around those lines, but from scratch
<FromGitter> <mverzilli> let me look for the repo
<RX14> it uses the same file with the actual logic unchanged
<RX14> just needs diofferent init code
<RX14> i'm not entirely sure where llvm passes are registered yet in the crystal compiler
<RX14> but i'm getting there
<FromGitter> <mverzilli>
yogg-saron has joined #crystal-lang
<RX14> hmm, looks like registering actual passes requires modifications to LLVM:
<RX14> or at least LLVM-C
<FromGitter> <ltran> you think there extra swag at the codecamp to purchase?
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> We have a full house at Crystal Codecamp
<FromGitter> <sdogruyol> :tada:
<FromGitter> <jwoertink> :tada:
<FromGitter> <ltran> :crystal_ball:
<RX14> this would look really weird on IRC if you didn't know about emoji haha
<FromGitter> <mverzilli> lol
<unshadow> crystal_ball ...
yogg-saron has joined #crystal-lang
<unshadow> XD
<FromGitter> <redcodefinal> Hello to everyone from #CrystalCodeCamp
<FromGitter> <johnjansen> ;-)
<FromGitter> <elorest> Also hello to everyone too :)
<FromGitter> <sdogruyol> Hey!
<FromGitter> <johnjansen> anyone want to transcribe the handle list ;-)
<FromGitter> <johnjansen> redcodefinal ⏎ ettomatic ⏎ samfrench ⏎ ertw ⏎ aaronbronow ... []
<FromGitter> <redcodefinal> @johnjansen ty
yopp has quit [Ping timeout: 260 seconds]
<FromGitter> <ertw> Here are the links to the repos as well: ⏎ ⏎ Ian Rash ⏎ ⏎ ... []
<unshadow> Cool !! Enjoy guys
<FromGitter> <redcodefinal> <#
yopp has joined #crystal-lang
<FromGitter> <sdogruyol> @ertw thanks
<FromGitter> <elorest> Working CRUD blog in Amber-cr.
unshadow has quit [Quit: leaving]
john has joined #crystal-lang
john is now known as Guest97954
Guest97954 has quit [Client Quit]
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> :+1:
<RX14> I wish I was there!
<FromGitter> <elorest> We do too.
<FromGitter> <jwoertink> Same
<FromGitter> <sdogruyol> Yeah we were talking about you @RX14
<FromGitter> <elorest> all good things ;)
<RX14> should I be scared? :)
<FromGitter> <sdogruyol> we love you :D
yogg-saron has joined #crystal-lang
<RX14> @sdogruyol i'll probably start work on crane again soon
<RX14> i've been inspired with new ideas ;)
<FromGitter> <redcodefinal> @RX14 exciting!
<FromGitter> <drujensen> @RX14 I've been hearing good things about you. really, its all good stuff! nice to meet you.
<FromGitter> <fridgerator> wish I could be there as well, have fun everyone
<RX14> they must be overstating...
<FromGitter> <sdogruyol> nope
<FromGitter> <sdogruyol> you get the credits you deserve
<FromGitter> <johnjansen> @RX14 your rep precedes you ;-)
<RX14> so, who has the best beard at the codecamp?
<FromGitter> <sdogruyol> it's @elorest
<FromGitter> <drujensen> definitely @elorest
<RX14> haha, yeah it seems so
<FromGitter> <marchyoung> IDK, I think vonKingsley is a contender!
<FromGitter> <elorest> You guys are too kind.
<FromGitter> <jwaldrip> @sdogruyol opened the issue we were talking about
<RX14> that's been discussed to death sadly
<RX14> well, not sadly, but it has
<FromGitter> <redcodefinal> @elorest fer shure
<RX14> and you really can't do much about unused methods due to crystal's typing
<FromGitter> <elorest> honestly though @vonKingsley probably has me beat on the beard.
<FromGitter> <aaronbronow> i'm new to docker. i pulled the crystal-lang image from dockerhub. what do i do to run crystal from this image?
<FromGitter> <redcodefinal> He's got a neat beard @elorest but you have that trademark linux beard.
<FromGitter> <elorest> Ok.
<FromGitter> <sdogruyol> @jwaldrip :+1:
<RX14> @jwaldrip I found an issue relating to yours just today but now I can't find it...
<FromGitter> <vonKingsley> my wife hacked mine, so @elorest has me beat
<FromGitter> <drujensen> @aaronbronow which docker image?
<FromGitter> <aaronbronow> crystallang/crystal
<FromGitter> <drujensen> `docker exec -it crystallang/crystal bash`
<FromGitter> <drujensen> then you can run crystal from the docker image
<FromGitter> <jwaldrip> ```code paste, see link``` []
<FromGitter> <jwaldrip> works ^^
<FromGitter> <jwaldrip> re: #CrystalCodeCamp
<FromGitter> <jwaldrip> @elorest I did NOT use vim.
<FromGitter> <drujensen> lol
<FromGitter> <elorest> I used crystal play lol.
<FromGitter> <elorest> needed to require json.
<FromGitter> <redcodefinal> Me too, it gives you good memory values in the output.
<FromGitter> <jwaldrip> ya, thats important.
<FromGitter> <jwoertink> Anyone know of a shard that has a `shard.yml` that pulls in some external lib, and builds it as part of the shard install process?
<FromGitter> <redcodefinal> icr?
<RX14> you mean it depends on a C library?
<FromGitter> <jwoertink> yeah
<RX14> I have which runs a build
<FromGitter> <faustinoaq> `crystal eval 'require "http";"", 8000,".")).listen'` #CrystalCodeCamp
<FromGitter> <elorest> sweet.
<FromGitter> <jwoertink> Awesome. Ok, so it looks like the common theme is to just use a Makefile to handle it
<FromGitter> <jwoertink> Thanks all
<FromGitter> <jwoertink> It's funny you mention icr @redcodefinal because I'm the one that wrote the postinstall process on that :joy: lol
<FromGitter> <redcodefinal> I love icr but I know its a hack
<FromGitter> <redcodefinal> Sometimes it gives me better error output than crystal play, but only in situations where I did something that was causing crystal play to not be able to compile.
<FromGitter> <jwoertink> yeah. I'm hoping crystal gets a boost in the readline lib. I think that will be important in making a solid repl
<FromGitter> <jwoertink> I wanted to add in lldb or gdb in to icr somehow, but that's above my paygrade
<FromGitter> <redcodefinal> I want a `pry` for crystal. It should be named `cry`
<FromGitter> <jwaldrip> lol
<FromGitter> <elorest> prycr lol
<FromGitter> <jwaldrip> but pry makes me not cry
<FromGitter> <norelevance> seconded
<FromGitter> <elorest> you can only replace rb with cr not pr.
<FromGitter> <redcodefinal> darn but i guess those are the rules
<RX14> it may be potentially possible in the future
<FromGitter> <aaronbronow> +1 for cry
<FromGitter> <norelevance> ; _ ;
<FromGitter> <redcodefinal> I `cry` everytime
<FromGitter> <redcodefinal> Do we have anything similar to ruby's marshalling?
<RX14> use an existing marshalling format
<FromGitter> <elorest> welcome to all the new people in gitter.
<FromGitter> <redcodefinal> @RX14 thank you! I'll definitely take a look!
<RX14> i hope to add a capnp shard one day
<RX14> i wish my todo list was shorter haha
sz0 has joined #crystal-lang
<FromGitter> <bararchy> RX14: you mean like a pcap file ?
<FromGitter> <bararchy> to generate traffic capture ?
<FromGitter> <redcodefinal> @Rx14 WHOA!
Ven has joined #crystal-lang
Ven is now known as Guest80030
<Papierkorb> > for (var i = 0; i < 3; i++) // try creating a new job 5 times at least.
<Papierkorb> ECHAN
<FromGitter> <redcodefinal> `3 == 5 #=> true`
<oprypin> i dont get it
<FromGitter> <redcodefinal> `i < 3` try job at least 5 times
<oprypin> i dont get it
<FromGitter> <mgarciaisaia> Getting dated - that's the best things comments do
wontruefree has joined #crystal-lang
<FromGitter> <jwoertink> Ok, here's the thing I've been asking so many questions about
<FromGitter> <jwoertink> it doesn't work, but there it is
<FromGitter> <jwoertink> If anyone gets bored, and wants to look it over and tell me all the things I'm doing wrong, that would be awesome :joy:
<FromGitter> <johnjansen> what does “doesn’t work” mean ;-)
<FromGitter> <jwoertink> it means the opposite of "work" ;)
<FromGitter> <redcodefinal> lol
<FromGitter> <johnjansen> ok then ;-)
<FromGitter> <jwoertink> it `!works`
<FromGitter> <johnjansen> obviously thats the problem then
<FromGitter> <redcodefinal> Problem: It doesn't work
<FromGitter> <jwoertink> but to be more specific, I get a Invalid memory access error
<FromGitter> <redcodefinal> Solution: Make it work
<FromGitter> <johnjansen> haha
<FromGitter> <jwoertink> from `LibHaywire.init_with_config(pointerof(config))`
<FromGitter> <johnjansen> nice solution, very elegant
<FromGitter> <jwoertink> ```code paste, see link``` []
<FromGitter> <redcodefinal> is pointerof(config) poitning to 0? That's a bit odd
<FromGitter> <jwoertink> it's pointing to a `LibHaywire::Config` instance which is a struct
<FromGitter> <jwoertink> is that what you mean?
wontruefree has quit [Quit: Is gone... Just plain old gone]
wontruefree has joined #crystal-lang
<FromGitter> <redcodefinal> No I mean the actual memory address is 0. Isn't it supposed to more randomly assign memory addresses? Is it always 0? Shouldn't ASLR be assigning it more randomly?
<FromGitter> <jwoertink> How do you know it's 0?
<FromGitter> <jwoertink> Is that what `at address 0x0` means?
<oprypin> redcodefinal, you are spreading confusion here.
<oprypin> nothing ever can have an address of 0, that's a guarantee.
<FromGitter> <redcodefinal> `Invalid memory access (signal 11) at address 0x0` isn't that because the pointerof(config) is 0?
<oprypin> no, it isn't
<FromGitter> <jwoertink> oh, I have no idea
<RX14> it's because it thinks that the pointer is 0, but it's not
<oprypin> jwoertink, i don't see anything wrong at a glance. possibly you need to set all the fields of the config?
<RX14> thats the bug
<RX14> a pointer which points at 0 is a null pointer
<FromGitter> <bigDaddyS1oth> So do we got some sick libraries for Crystal now? I know Sidekq is already in Crystal, maybe we could get DataMapper next? Crecto looks great
<RX14> and you just dereferenced it
<FromGitter> <redcodefinal> @rx14 so I was right?
<RX14> no
<FromGitter> <redcodefinal> aww
<FromGitter> <jwoertink> ah. I'll try setting all those configs
<FromGitter> <redcodefinal> Oh I see `pointerof(config) ` isnt 0, but a field is
<RX14> no again
<oprypin> why not, seems likely
<RX14> oh never mind
<oprypin> ugh this is up to interpretation
<RX14> yeah you can't tell
<RX14> you might be right sorry
<RX14> i'd stick gdb in here
<oprypin> i'd just look for mistakes and compare to C examples
<FromGitter> <redcodefinal> It's ok I have only a minimal idea of what Im talking about here and since I'm not a C wizard
<oprypin> jwoertink, because this one does not set all fields, you may as well forget what i said.
Guest80030 has quit [Ping timeout: 255 seconds]
<FromGitter> <jwoertink> yeah, that's what I was trying to base my sample off
Ven has joined #crystal-lang
Ven is now known as Guest95275
<FromGitter> <redcodefinal> @jwoertink what are you doing to compile it? `make`? `shards build`?
<FromGitter> <johnjansen> @RX14 gets a mention ;-)
<RX14> hmm?
Guest95275 has quit [Ping timeout: 245 seconds]
<FromGitter> <jwoertink> @redcodefinal I'm just running `crystal exmaples/`
<FromGitter> <jwoertink> I already have the dependencies built and installed
<FromGitter> <redcodefinal> @jwoertink how are you installing haywire? I'm getting errors about not having it and it seems like your make file downloads it
<FromGitter> <redcodefinal> I guess I have to install it myself
<FromGitter> <jwoertink> I may not have done that right
<FromGitter> <jwoertink> I just cloned it, then ran the `./`
<RX14> if you didn't install haywire right likely it just wouldn't link
<FromGitter> <jwoertink> yeah, I was getting linking errors earlier, but those are gone now
<FromGitter> <jwoertink> once the `` completes, there will be a `build/Debug/libhaywire.a`file. I just moved that to my `/usr/local/lib`
Ven_ has joined #crystal-lang
<FromGitter> <redcodefinal> @jwoertink ty
<FromGitter> <jwoertink> Thanks for taking a look :)
<FromGitter> <redcodefinal> No prob, although I'm probably not going to be much help
<FromGitter> <jwoertink> sometimes it just takes a second set of eyes to catch something simple
<oprypin> it ain't simple
<FromGitter> <redcodefinal> when c is involved its never simple
<FromGitter> <jwoertink> I meant in general. Typos, etc...
<FromGitter> <redcodefinal> yeah no prob ill see what I can do
<FromGitter> <redcodefinal> I'm just slowly compileing haywire
<FromGitter> <redcodefinal> slowly
<oprypin> jwoertink, at this point i'd question the validity of that example in C
<FromGitter> <jwoertink> True. I haven't tried to run that one. When you build the project, it does give you a "hello_world" sample, so I know haywire runs at least. I'll see if I can find any other examples
<FromGitter> <jwoertink> I think this is the one built
Ven_ has quit [Ping timeout: 240 seconds]
<oprypin> jwoertink, hello_world sample looks sound to me, but try the one you're porting over..
<FromGitter> <jwoertink> :thumbsup:
Ven_ has joined #crystal-lang
<oprypin> looking at source code, hw_init_with_config ends up calling strlen on every field and strlen on a null pointer seems like exactly what would cause this error
<oprypin> so try setting at least the string fields, maybe that'll fix it
<oprypin> that sample hasnt been updated since some of the fields were added :/
Ven_ has quit [Client Quit]
<FromGitter> <jwoertink> whoa!
<FromGitter> <jwoertink> That was it
<FromGitter> <jwoertink> I set all the fields, and it boots!
<FromGitter> <jwoertink> :D
<FromGitter> <jwoertink> Thanks for that suggestion @oprypin
<FromGitter> <redcodefinal> Nice
<FromGitter> <redcodefinal> Congrats
<oprypin> what a waste of time, porting an initially broken example...
<FromGitter> <redcodefinal> haha of course my make failed the second I left for lunch
zipR4ND has joined #crystal-lang
wontruefree has quit [Quit: Is gone... Just plain old gone]
wontruefree has joined #crystal-lang
Ven_ has joined #crystal-lang
Ven_ has quit [Client Quit]
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <bigDaddyS1oth> do we have a definitive way to add `shards` as a command in BASH? I.E. via a script like how you can add RVM to your ~/.bashrc?
<FromGitter> <bigDaddyS1oth> As a globally available command, that is.
<FromGitter> <redcodefinal> Does shards not run when you type in shards in any current working directory?
<RX14> if you're on debian or arch install the package
<RX14> osx, install the package
<FromGitter> <codenoid> hi sir, how to do `for` in crystal, i cant found that syntax in crystal doc
<FromGitter> <redcodefinal> @codenoid `times` do
<RX14> @codenoid crystal doesn't have a for loop concept
<FromGitter> <redcodefinal> @codenoid `29.times {|x| puts x}`
<RX14> .times or .each is what you'd typically replace for loops with
<FromGitter> <bigDaddyS1oth> @redcodefinal it says that it can't find a `shards.yml` file. Is it as simple as pointing the `~/.bashrc` to the `.yml` file?
<FromGitter> <codenoid> how in crystal ?
<FromGitter> <redcodefinal> nonon
<FromGitter> <redcodefinal> ok
<FromGitter> <redcodefinal> @bigDaddyS1oth you need to use `shards init` to initialize a directory for a crystal program/library to use
<RX14> @bigDaddyS1oth no, a shards.yml file is required in each crystal project's directory
<RX14> to generate a shards.yml use `shards init`
<RX14> or `crystal deps init` if shards isn't installed
<FromGitter> <jwoertink> @codenoid ```
<RX14> @codenoid that would be t.downto(0) { |j| t.downto(0) { |i|
<FromGitter> <redcodefinal> @codenoid You should use while loops if you need to make for loops like that
<FromGitter> <jwoertink> ```t = 8 ⏎ t.downto(0) do |i| ⏎ end``` []
<RX14> @redcodefinal using downto is cleaner
<FromGitter> <redcodefinal> Yeah I agree thats why I removed
<FromGitter> <bigDaddyS1oth> @redcodefinal oh hmmm well I have an directory already for crystal with a `shards.yml` file. I actually added some libraries to the `.yml`like kemal and such. `shards` works from that directory, just not as a global command
<FromGitter> <redcodefinal> yes
<FromGitter> <redcodefinal> @bigDaddyS1oth yes thats intended. `shards` can't do anything outside a crystal program directory except `init`
<FromGitter> <bigDaddyS1oth> @redcodefinal ahh okay. I just misunderstood then. Thanks!
<FromGitter> <redcodefinal> @bigDaddyS1oth np
<FromGitter> <bigDaddyS1oth> @redcodefinal if I learned some Linux shell scripting, or if there is someone who knows Linux scripting well, we could make a script to add to the Crystal repository so people could use `shards` as a global command.
<FromGitter> <redcodefinal> @bigDaddyS1oth shards is a global command in bash
<FromGitter> <redcodefinal> If you type in shards in any CWD it will run the program and complain that it needs a shard.yml
<FromGitter> <bigDaddyS1oth> @redcodefinal oh...yea. Right. Sigh....I need a break from studying.
<FromGitter> <redcodefinal> @bigDaddyS1oth it's ok
<FromGitter> <redcodefinal> @bigDaddyS1oth I've asked and said my fair share of stupid things here
<FromGitter> <bigDaddyS1oth> Oh if anyone wants to study up on Crystal, or any other language for that matter, check out exercism (
qrr has joined #crystal-lang
fenicks has joined #crystal-lang
<FromGitter> <jwaldrip> @asterite - @waj mentioned an issue requesting comments on adding an `interface` keyword. I would like to give my input on it, do you have the issue #?
wontruefree has quit [Quit: Is gone... Just plain old gone]
<Papierkorb> why on earth would we need `interface`
<RX14> interface is a module with only abstract methods
<RX14> so there's no point lol
<FromGitter> <rockwyc992> Does Crystal have `module_eval` like what Ruby does? ⏎ Code: ⏎ ⏎ ```code paste, see link``` []
wontruefree has joined #crystal-lang
<Papierkorb> No it doesn't have any eval method
<FromGitter> <redcodefinal> @rockwyc992 no `eval` or `exec` (like `instance_exec` or `class_exec`) in Crystal
<FromGitter> <danfarina_twitter> Hello I have some feedback about the concurrency part of the crystal manual. It is missing information about `select`, when multiplexing channels. @will sent me the tests for `` and I get it, yet it seems pretty brutally low-level (with the {index, result}) tuple.
<FromGitter> <rockwyc992> What I really need doesn't the effect of `eval` . ⏎ I want Crystal raise an exception at the customized location (like `filename:line_number` )
<Papierkorb> rockwyc992, for what? Are you generating code?
<FromGitter> <redcodefinal> @papierkorb Whoa didn't know about that
<FromGitter> <rockwyc992> @Papierkorb Use comment do that? wow
<Papierkorb> It's a special kind of "comment", yeah
<Papierkorb> It's kinda what you'd see in C code for that
<RX14> I remember learning about those comments but i totally forgot about them until that reddit thread lol
Raimondi has quit [Quit: WeeChat 1.8-dev]
Ven has joined #crystal-lang
Ven is now known as Guest14984
<FromGitter> <jwaldrip> Some code and attendees from #CrystalCodeCamp
<FromGitter> <jwaldrip> although I still dont know what `with amount` does...
<FromGitter> <redcodefinal> @jwaldrip there shouldn't be a need for interface, everything an interface would do is already basically covered by `module` and `abstract`
<FromGitter> <jwaldrip> @redcodefinal Yes, but then you have to look at the code to find out when its an interface and when its a module. An interface should only focus on the interface aspect and could not extend it with other methods.
<FromGitter> <jwaldrip> Right now modules can do both.
<Papierkorb> jwaldrip, `with amount` defines `with` as public argument name and `amount` as internal one. So you can write `cup.fill with: 5`, and that 5 will be accessible as `amount` in the code itself
<FromGitter> <jwaldrip> Which is fine, they can continue to do so.
<FromGitter> <redcodefinal> @papierkorb are you an encyclopedia of cool crystal knowledge?
<FromGitter> <rockwyc992> I try that. ⏎ Code : ⏎ ⏎ ```Division by zero (DivisionByZero) ⏎ 0xabcdef: __crystal_main at / 11:1``` []
<Papierkorb> Well *that* part is actually mentioned casually in the lang docs
<Papierkorb> Though most don't know about it, which is a shame. The idea of it is really good
<FromGitter> <redcodefinal> @jwaldrip Yeah I can understand where you are coming from but, I don't see the point in interfaces since it would add an unnecessary set of complexity to something that already works. Although, I think the way to do this the way you mention is to make a macro that would work like ⏎ ⏎ `````` []
<FromGitter> <jwaldrip> The difference is also, a module must be included to allow for it to become that interface. While an interface can be a type on a method argument and as long as the given object "plugs" to that interface then it could be passed.
<FromGitter> <jwaldrip> Dont think that can be done with a macro
<Papierkorb> jwaldrip, traits could also be done with abstract-only modules, iirc there was a GH issue discussion abou that
<FromGitter> <rockwyc992> But it doesn't work for customized exception. ⏎ I think this it bug or something. ⏎ Code: ⏎ ⏎ ```code paste, see link``` []
<Papierkorb> jwaldrip, considering that such a module would actually be pretty short it wouldn't be too bad in terms of readability imho
<Papierkorb> rockwyc992, put those lines into a method, it doesn't work on the top level
<FromGitter> <redcodefinal> @jwaldrip Yeah I can understand where you are coming from but, I don't see the point in interfaces since it would add an unnecessary set of complexity to something that already works. Although, I think the way to do this the way you mention is to make a macro that would work like ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <rockwyc992> @Papierkorb thanks a lot. It is really helpful for me and what I am doing.
<FromGitter> <redcodefinal> @jwaldrip that code probably doesn't work but the point is there.
<Papierkorb> Is there a stable JSON RPC lib?
<FromGitter> <jwaldrip> ```code paste, see link``` []
<FromGitter> <jwaldrip> Something like that
<FromGitter> <jwaldrip> the face that `SomethingWriteable` is a `Writeable` is implicit.
<FromGitter> <jwaldrip> Where as if I used a module I would have to include it. Or am I wrong?
<Papierkorb> jwaldrip, that could be done through abstract-only modules too. I want a feature like that, but adding another keyword and everything that goes into that would add quite a complexity burden into the language where as we could model that with something we already have
<FromGitter> <jwoertink> I'm not familiar with interfaces in other languages, so ^ that code looks really confusing to me
<FromGitter> <redcodefinal> @jwaldrip maybe I am missing something here but isnt ⏎ ⏎ ```module X ⏎ abstract def interface_method ⏎ end``` ⏎ ⏎ implicit too? []
<FromGitter> <jwoertink> How would `SomethingWritable` know it included that `Writeable` interface?
<FromGitter> <jwaldrip>
<FromGitter> <jwoertink> LOL! The other guys I work with asked if we could start using go. I said it was too confusing
<FromGitter> <jwaldrip> Something Writeable does not need to know that it implements the interface.
<Papierkorb> jwaldrip, right now you'd need to include it, correct. This could change for this case though. You can actually simulate this already to some extend by re-opening your target classes just to include your interface module.
<FromGitter> <jwaldrip> The implementer cares about the interface, not the underlying implementation.
<FromGitter> <redcodefinal> The thing about interfaces (and correct me if I am wrong) but they were generally used to cheat in multiple inheritance by not allowing a method definition. There is not really a point to that for crystal since we already have `include` and `extend` which essentially already do that.
<FromGitter> <jwoertink> so, an interface is like documentation?
<FromGitter> <jwaldrip> ... what do you mean?
<FromGitter> <redcodefinal> @jwoertink no it is like a header file in C that is includeable into a class. You aren't allowed to use instance variables inside an interface, you arent allowed to define method bodies only method signatures
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> ok
<FromGitter> <jwaldrip> ^ right!
<Papierkorb> Huh no one has built a JSON RPC lib yet? Can't find anything on crystalshards xyz
<Papierkorb> That's surprising
<FromGitter> <redcodefinal> Basically everything is a method inside an interface and I can inherit it along with an actual subclass
<FromGitter> <redcodefinal> we dont have sftp and ftp either if I'm not mistaken
<FromGitter> <redcodefinal> @jwaldrip I got a working version of the interface macro
<Papierkorb> redcodefinal, the point would be that you do not have to manually include it
<Papierkorb> Traits ("interfaces" is burned as name thanks to Java) are just "there"
<FromGitter> <redcodefinal> oh but even with real interfaces like in C# you have to tell the object you are inheriting it one way or another.
<FromGitter> <redcodefinal> Oh ok I thought we were talking about C++/C# style interfaces
<Papierkorb> No cause they suck
<FromGitter> <redcodefinal> Yeha they do
<FromGitter> <redcodefinal> Yeah traits sounds like some black magic. I'll have to look into it a little more.
<Papierkorb> It's basically just a way to say "i want something that can run and quack", you could call it "typed duck typing"
<FromGitter> <redcodefinal> There guys right?
<FromGitter> <redcodefinal> Also typed duck typing is my new favorite oxymoron
<Papierkorb> I frankly don't know if I wanted to use PHP as example, no idea of their idea of traits matches mine
<Papierkorb> Or if their idea of traits is sane in any way, it's PHP
<FromGitter> <redcodefinal> yeah it seems more like modules than anything
<FromGitter> <redcodefinal> it seems sane, at least in the context of crystal, maybe not in PHP
zipR4ND1 has joined #crystal-lang
<FromGitter> <redcodefinal> it has a `use` that seems similar to `include
<Papierkorb> Go calls them `interfaces`, Rust `traits`
<Papierkorb> Though I don't know Rust, I don't know what they're doing with it really
zipR4ND has quit [Ping timeout: 255 seconds]
qrr has left #crystal-lang ["Leaving"]
qrr has joined #crystal-lang
<FromGitter> <jwoertink> alright, so my example is updated
<qrr> hey, guys!
<qrr> (ofc this snippet doesn't work, just illustrating what i want)
<qrr> so, i'd like to have some sort of a "abstract type" in my Base-module, which i'd then like to then define in my Derived-module:
<qrr> is there any way to do this in crystal, currently?
<qrr> you can't just make Foo an type parameter of Base... classes inside modules don't inherit their type parameters
<Papierkorb> qrr: Not really like that, were you looking for generics?
<qrr> Papierkorb, well yea, but like i said, classes inside Base don't inherit Base's type parameters
<qrr> messing around with that, i even managed to produce an internal compiler error
<crystal-gh> [crystal] joaodiogocosta opened pull request #4403: Add option to HTTP::StaticFileHandler initializer to disable directory listing (master...static-file-handler-optional-directory-listing)
Guest14984 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <redcodefinal> @qrr what about something like this
zipR4ND1 has quit [Ping timeout: 240 seconds]
<qrr> redcodefinal, ya, seems like either that or maybe moving the whole lot of Base into a macro is gonna be the solution here...
<qrr> not really happy with that, thanks tho
<FromGitter> <redcodefinal> Yeah I was trying to do the macro thing but I couldn't figure it out. I don't blame you for not liking that I don't even like it and it probably has some nasty caveats.
<FromGitter> <redcodefinal> Hey what am I doing wrong here? Crystal doesn't seem to want to let me use the `::` operator to access constants from generics
<FromGitter> <redcodefinal> Ok I'm a little confused here
<qrr> heh
<qrr> generic modules seem to be really wonky
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<qrr> maybe they're only intended to be used by including/extending them from other modules?
<FromGitter> <redcodefinal> @qrr not just modules, classes as well
<qrr> odd
<FromGitter> <redcodefinal> @qrr got another interesting result
<FromGitter> <redcodefinal> Good recommendation trying that, I'm with the core devs now so I'll ask them about it when class is done
<FromGitter> <marchyoung> *brew install crystal-lang --with-llvm* installs crystal-lang, but gives message *Warning: crystal-lang: this formula has no --with-llvm option so it will be ignored!*
<FromGitter> <redcodefinal> @marchyoung maybe it doesn't need it anymore? Does crystal at least run? try `crystal eval "puts :test"`
<FromGitter> <elorest> Here’s a thing that took me a second to figure out with bindings.
wontruefree has quit [Quit: Is gone... Just plain old gone]
<FromGitter> <elorest> embedding my own compiled c files.
<FromGitter> <norelevance> it doesn't need it
<FromGitter> <bew> Nice @elorest!
<FromGitter> <elorest> Also shows how to pass structs.
<FromGitter> <marchyoung> @redcodefinal: Code runs as expected, but documentation recommends using this flag option for contributor development purposes.
<FromGitter> <faustinoaq> @rockwyc992 `run` something similar to `eval` but at compile time see
LastWhisper____ has joined #crystal-lang
<FromGitter> <bew> @faustinoaq you mean the macro method `run`? (docs:
balduin has joined #crystal-lang
<FromGitter> <faustinoaq> yes, I just realized that `run` macro exist
<FromGitter> <elorest> `run` is the best.
<FromGitter> <elorest> also `system`
<FromGitter> <elorest> The best part of snake_case is SCREAMING_SNAKE_CASE
qrr has quit [Quit: Leaving]
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
sp4rrow has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Quit: Textual]