<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
<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 https://github.com/emoon/minifb 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) https://git.io/v10NI
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? https://github.com/emoon/rust_minifb
<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
<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>
<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?
<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
<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/server.cr`
<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 `./make.sh`
<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 `make.sh` 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
<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
<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>
<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 (http://exercism.io/languages)
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
<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 `Channel.select` 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>
<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` https://carc.in/#/r/20hw
<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?
<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 ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5914d3939f4f4ab05bb5b44d]
<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
<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``` [https://gitter.im/crystal-lang/crystal?at=5914d4398a05641b117295f0]
<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.
<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>
<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
<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: https://play.crystal-lang.org/#/r/20i8
<qrr>
is there any way to do this in crystal, currently?
<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? https://play.crystal-lang.org/#/r/20j0 Crystal doesn't seem to want to let me use the `::` operator to access constants from generics
<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"`
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.