ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
alex`` has quit [Ping timeout: 240 seconds]
sam0x17 has joined #crystal-lang
<FromGitter> <Sevensidedmarble> Does anyone know how the return process::status from process.wait works? I don't quite get what the waitpid_future.get line means. Does that return the status of the process?
<FromGitter> <Sevensidedmarble> My Confusion it seems like #wait blocks, so how can you know when the status of said process has changed?
<oprypin> Sevensidedmarble‎, it blocks until the process has finished
<oprypin> i dont understand what part is not clear
<FromGitter> <Sevensidedmarble> What if you need to watch for changes to the processes status?
<oprypin> Sevensidedmarble‎, there is no such thing. a process produces a status simultaneously with its termination
<FromGitter> <Sevensidedmarble> I was under the impression that a process that's stopped via sigstop signal was still running, just paused.
<FromGitter> <Sevensidedmarble> Does that count as terminated?
<oprypin> no
<FromGitter> <Sevensidedmarble> So what if you need to monitor another process for that?
<oprypin> this tires me. what do you actually want to do?
<FromGitter> <Sevensidedmarble> Well that's literally what I'm trying to do, I have a shell that spawns processes and waits for them to finish, but I need to be able to pause them with ctrl z like any other shell and resume them later. But I can't just block until they terminate, I need to know when they've paused.
<FromGitter> <Sevensidedmarble> Sorry it's hard to phrase the question as I haven't dealt much with linux processes before
<hightower3> Do signals work? I do Signal::USR2.trap {something}, but the program exits rather than execute block
<oprypin> Sevensidedmarble, i dunno man it's doable but very difficult https://linux.die.net/man/2/waitpid
<FromGitter> <Sevensidedmarble> Yeah I was kind of surprised that crystal didn't expose some sort of api to waitpid
<FromGitter> <Sevensidedmarble> I believe ruby has its own waitpid method
<hightower3> What's an equivalent of Ruby's Process.waitpid?
<oprypin> no equivalent
<FromGitter> <Sevensidedmarble> There's a Process#waitpid there
vivus has quit [Quit: Leaving]
notdaniel has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
astronavt has joined #crystal-lang
astronavt has quit [Remote host closed the connection]
notdaniel has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <pnloyd> @RX14 are you around?
sz0 has quit [Quit: Connection closed for inactivity]
snsei has quit [Remote host closed the connection]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <codenoid> anybody know, enter send_keys in https://github.com/ysbaddaden/selenium-webdriver-crystal
<FromGitter> <bararchy> oprypin I didn't bind it into the Crystal interface, but it seems the C API allows it, if you need it I'll add it: http://libfann.github.io/fann/docs/files/fann-h.html#fann_get_weights
<FromGitter> <bararchy> ok , so you have ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ in LibFANN, you can call it manually on your network, but again, if you need I'll add it to the networks [https://gitter.im/crystal-lang/crystal?at=5a052e1632e080696e88733c]
sam0x17 has quit [Quit: leaving]
<FromGitter> <pnloyd> Does anyone know what the `$` in `$stackbottom = GC_stackbottom : Void*` is doing? The context is inside a `lib LibGC ... end`
<FromGitter> <pnloyd> @oprypin, what do you make of this?
<FromGitter> <pnloyd> That's what I wanted to show @RX14
<oprypin> i have no opinion
<FromGitter> <pnloyd> It would cool if Crystal got a performance boost like that for free.
snsei has quit [Remote host closed the connection]
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <Rinkana> It does look interesting. But there have to be some drawbacks with it.
<FromGitter> <pnloyd> That's what I was thinking, hopefully someone knowledgeable on the subject in the Crystal team looks at it.
<FromGitter> <Qwerp-Derp> I have an executable `foo` in Mac OS X, and I have a bunch of `.dylib` files which `foo` dynamically links to in the folder `dylib`. How do I statically link those dynamic libraries?
<FromGitter> <iambudi> Hi...
<FromGitter> <iambudi> what’s new in amber now? kind of busy these two days...
<FromGitter> <iambudi> Ups wrong room
<FromGitter> <iambudi> 🙏
<FromGitter> <crisward> Wrong mineral?
<FromGitter> <iambudi> Haha yes
Ven has joined #crystal-lang
Ven is now known as Guest25031
Guest25031 has quit [Ping timeout: 240 seconds]
<FromGitter> <petoem> good morning
claudiuinberlin has joined #crystal-lang
snsei has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
<FromGitter> <r3bo0t> Does `HTTP::Client` allow to choose/set http versions 1.1/1.0/0.9 in case the requested webserver doesn’t support 1.1
<livcd> wrong mineral lol :)
<FromGitter> <petoem> @r3bo0t you can exec a custom `HTTP::Request` with `HTTP::Client` ⏎ https://crystal-lang.org/api/0.23.1/HTTP/Client.html#exec%28request%3AHTTP%3A%3ARequest%2C%26block%29-instance-method ⏎ https://crystal-lang.org/api/0.23.1/HTTP/Request.html#new%28method%3AString%2Cresource%3AString%2Cheaders%3AHeaders%3F%3Dnil%2Cbody%3AString%7CBytes%7CIO%7CNil%3Dnil%2Cversion%3D%26quot%3BHTTP%2F1.1%26quot%3B%29-class-method
<FromGitter> <montychen> I run the command: Kemal.run
<FromGitter> <montychen> in lib/kemal/src/kemal/helpers/helpers.cr:137: undefined method 'open' for Flate::Writer:Class ⏎ ⏎ ``` Flate::Writer.open(env.response) do |deflate|``` [https://gitter.im/crystal-lang/crystal?at=5a056be286d308b755cef477]
Papierkorb_ has joined #crystal-lang
<crystal-gh> [crystal] j8r closed pull request #5230: FileUtils: Add a recursive `chmod_r` and `chown_r` (master...recursive_chmod_chown) https://git.io/vF3go
<FromGitter> <bararchy> @montychen you better ask Kemal relates questions in the Kemal room :)
<FromGitter> <bararchy> @sdogruyol and @crisward would be more then happy to help you :)
<FromGitter> <crisward> @montychen Use that last release of kemal, not master, unless you're using the pre-release version of crystal
<FromGitter> <crisward> @sdogruyol I'll happily do a pull request with that macro if you change your mind about this issue.
<FromGitter> <sdogruyol> I don't understand why would anyone uses Kemal master
<Papierkorb_> latest+greatest
ShalokShalom has joined #crystal-lang
<FromGitter> <crisward> There are some bug fixes which make it necessary for me at the moment.
<FromGitter> <crisward> Also, internally we try and keep master 'deployable'. New features in branch, merge when passing. Fixes straight onto master. I suppose it depends what you're used to and how far apart the releases are.
<FromGitter> <montychen> thanks. I see.
<FromGitter> <bararchy> @sdogruyol I'm using master :) because I'm running 0.24
ShalokShalom_ has joined #crystal-lang
<vegai> does crystal need the === -operator, I wonder
<vegai> I guess I've wondered this before
ShalokShalom has quit [Ping timeout: 268 seconds]
<vegai> so I'll answer it myself, why not :P === is "case equality", defined in Object
<vegai> there's something I don't get about this yet, though
<vegai> the Book says "For example, Class defines case equality as when an object is an instance of that class"
<vegai> shouldn't that mean that a="1"; a===String => True?
<vegai> but it's not
<vegai> oh dear
<vegai> a="1"; String===a *is* true
<vegai> it's not commutative. Is that bad?
<Yxhuvud> It is quite expected. At least if crystal follow the lead of ruby, === is used in case statements, meaning you can put in classes or regexps or whatever in there.
<vegai> would it hurt if this was mentioned in the Book?
<FromGitter> <crisward> @bararchy how is 0.24, much work to update?
<FromGitter> <bararchy> Nope, just a single line (open/new)
<FromGitter> <bararchy> For the tar handler
<FromGitter> <crisward> Nothing to change in your own code?
<Yxhuvud> vegai: it is clear that it isn't commutative from reading that page. perhaps not explicitly stated, but very obvious from the examples.
<FromGitter> <Rinkana> What is the Crystal version of `uint64_t`? Just `UInt64`
<FromGitter> <bew> Yes
<Papierkorb_> vegai: It should be mentioned that using === on your own is usually a bad idea
<Yxhuvud> it is more that it is almost always a more readable way to get what you want.
<FromGitter> <bararchy> @crisward only SecureRandom
Ven has joined #crystal-lang
binBASH has joined #crystal-lang
Ven is now known as Guest32862
<FromGitter> <crisward> Looking through the changelog, I've hit almost all of them, and some dependencies need updating too. Think I'll wait for the full release then make changes then. Nice thing with crystal, at least the compiler will tell me if I miss any.
Guest32862 has quit [Ping timeout: 250 seconds]
<FromGitter> <bararchy> That's true :)
<FromGitter> <pnloyd> @Papierkorb , do you think the immix GC is possible?
<FromGitter> <pnloyd> Err viable rather than possible.
<FromGitter> <sdogruyol> what's that?
<Papierkorb_> Depends on what it actually is
<Papierkorb_> don't have the time to watch the whole talk, nor read their source
<FromGitter> <pnloyd> @sdogruyol , I made an issue about in on the Crystal repo. https://github.com/crystal-lang/crystal/issues/5271
<Papierkorb_> In any case, it'd probably require complex changes to the compiler
<Papierkorb_> If that'd make the compiler and stdlib provide a more agnostic GC interface to hook into, that'd be great
<FromGitter> <pnloyd> @Papierkorb , I'm super curious. @ysbaddaden identified a possible block.
<Papierkorb_> And it won't work "plug and play" at all
<Papierkorb_> Boehm is purely conservative, which is great. You just use boehms allocation function instead of pure malloc(). That's it.
<FromGitter> <pnloyd> Ya see that's where my extremely naive knowledge is embarrassing me there..
<Papierkorb_> Immix seems to be precise, hence it'd require type information, making this not possible anymore.
<FromGitter> <sdogruyol> considering that it's coming from a JVM background...plug and play sounds too good to be true
<FromGitter> <pnloyd> No
<FromGitter> <pnloyd> It's not JVM
<Papierkorb_> Maybe I'll look at it this week-end
<FromGitter> <sdogruyol> isn't this bundled with Scala?
<FromGitter> <pnloyd> Scalla native has nothing to do with the JVM
<FromGitter> <sdogruyol> I meant the mindset of those languages anyway :P
<Papierkorb_> I may already know where to hook into to get that type information for an experimental awful GC I wrote
<FromGitter> <crisward> Sounds like a nice weekend project.
<Papierkorb_> pnloyd > @Papierkorb, also I think intuition would tell you that if (i assume so) scal-native can seamlessly switch between boehm and immix, Crystal would be able to as well.
<Papierkorb_> That doesn't mean it at all
<FromGitter> <pnloyd> They re-implement the parts of the Java stdlib the scala stdlib needed.
<Papierkorb_> crisward, but then, I planned other things to do
<FromGitter> <pnloyd> @Papierkorb, I know it's a lot more complicated than that.
<FromGitter> <crisward> I've got an Irish wedding to go to... don't think I'll be capable of programming after, for a while...
<FromGitter> <sdogruyol> lol
<FromGitter> <sdogruyol> @crisward have fun :)
<FromGitter> <pnloyd> @Papierkorb , I was just trying to push the idea that it might be possible and the performance gains are too dramatic to be overlooked.
<Papierkorb_> In *their* benchmarks
<Papierkorb_> Are they applicable to Crystal?
<Papierkorb_> No one can tell until trying it in Crystal
<FromGitter> <pnloyd> Are a big part of my point is that it might not be hard to try..
<Papierkorb_> Which is where you may be totally off
<FromGitter> <pnloyd> I agree.
<FromGitter> <sdogruyol> @pnloyd thanks for the issue 👍
<FromGitter> <pnloyd> @sdogruyol, hopefully it can be a win for Crystal, :-/
<Papierkorb_> I'm confused, is boehm an actual problem for you right now?
<Papierkorb_> The real elephant is threading support (and then Windows support probably). Multi-threading is where we'll see GCs simply break
<FromGitter> <pnloyd> Ya I have a program that is making lot's of small memory allocations but.. It's not like the GC it biased for my case.
<FromGitter> <pnloyd> @Papierkorb, I think I really interesting thing to consider is the scala-native is fighting almost identical issues to Crystal. (windows support, threading, and others)
<Papierkorb_> As has Rust
<FromGitter> <pnloyd> After spending a lot of time looking at both projects I was honestly amazed at the number of parallels I was able to draw.
<Yxhuvud> pnloyd: you need something more generational than boehm?
<Yxhuvud> what algorithm does immix use?
<Papierkorb_> immix is immix
<vegai> Yxhuvud, Papierkorb_: ok
<FromGitter> <pnloyd> I don't know anything about GC's
<vegai> I'm not sure why Windows support or parallelism are that important, really
<Papierkorb_> Because forking isn't fun?
<vegai> ;)
<FromGitter> <pnloyd> And applications/ use cases..
<FromGitter> <pnloyd> Why wouldn't language want to say, "I run in any environment, natively and faster that all other languages."
<vegai> well... it's mostly games and some scientific applications that practically require parallelism
<Papierkorb_> If that is the case, it's most likely not possible to be used
<vegai> I mean sure, if it's possible to implement parallelism without breaking simplicity and the language, there's no reason not to do it
<Papierkorb_> .. And everything that's highly concurrent
<Yxhuvud> pnloyd: because fortran is already occupieing that space. Except that it does concurrency too.
<Papierkorb_> pnloyd, because that's easier said than done
<FromGitter> <pnloyd> @Papierkorb, how sure are you? If your very sure then I should close the issue so any Crystal devs time isn't wasted looking at it.
<Yxhuvud> Papierkorb_: Is there more than support for C extensions that make you don't think compaction is feasible?
<Yxhuvud> *is not
<Papierkorb_> `a = Bytes.new(20); b = a[5..10]`
<Papierkorb_> pnloyd, you'd have to read the paper to know for sure.
<FromGitter> <pnloyd> @Papierkorb , I'll trust you ;-)
mbarbar has joined #crystal-lang
<Papierkorb_> But I wouldn't, cause I simply flew over the linked slideshow
<Papierkorb_> wrt Compaction, is there a recent study showing if it's actually beneficial nowadays?
<Papierkorb_> Outside of microbenchmarks tuned to showcase that holes happen?
<Yxhuvud> Isn't the alternative eventual death by fragmentation?
<Papierkorb_> Eventual?
<Papierkorb_> Yeah if you exhaust the 2^48-ish virtual memory space of modern x64 machines
<Papierkorb_> and never can find a hole to fit your data in, which is unlikely
notdaniel has joined #crystal-lang
flaviodesousa has joined #crystal-lang
<FromGitter> <r3bo0t> @petoem thanks I will try the same.
<FromGitter> <5minpause> Hi. Is anybody here?
Ven has joined #crystal-lang
Ven is now known as Guest3192
<FromGitter> <5minpause> I have a question and I cannot find the answer. Was hoping you could help me. ⏎ ⏎ 1) I created a new module that I want to use as a type for arguments for my method. ⏎ 2) I allowed the type for the method. ⏎ 3) I want to have Int32 and Int64 "behave" as this type as well. So I wouldn't have to allow Int32 as type by itself, but still be allowed to use it as a method argument. ...
Guest3192 has quit [Ping timeout: 248 seconds]
<FromGitter> <fridgerator> Union type?
notdaniel has quit [Quit: Leaving]
<FromGitter> <5minpause> Sorry I am new to crystal. Thanks for your response. That would mean that I specify several types for the method argument, right? Could I just extend existing types with my new type? so I would only need to allow my new type and have the rest implicitly?
alex`` has quit [Quit: WeeChat 1.9.1]
<FromGitter> <fridgerator> I'm not exactly sure what you mean, but you can create your own new type `alias MyNewType = Int32 | Int64 | SomeOtherType`
vivus has joined #crystal-lang
<RX14> @5minpause do you mean a type that behaves like `Int32` but isn't compatible? Like newtype in haskell? We don't have that i'm afraid
<FromGitter> <fridgerator> or you could look at generics: https://crystal-lang.org/docs/syntax_and_semantics/generics.html
alex`` has joined #crystal-lang
<FromGitter> <5minpause> Alright, so my method looks like this (hope I get the syntax highlighting right): ⏎ `def foo (content : String | MyNewModuleAsAType)`
<FromGitter> <5minpause> `module MyNewModuleAsAType; end`
<FromGitter> <5minpause> No I image doing `struct Int32; include MyNewModuleAsAType; end`
<FromGitter> <5minpause> and then use `foo(3)`
<FromGitter> <5minpause> or include my module somewhere else and by able to use that as an argument to `foo`
<FromGitter> <5minpause> does that make sense?
<FromGitter> <5minpause> imagine I write a library and want users to be able to have their own types include my module, so their types can be passed to `foo` as well
<RX14> why not just not specify a type
<RX14> why do you need to patch Int32?
<RX14> what's the actual usecase here?
<FromGitter> <5minpause> Because I cannot foresee what types will be passed to the method
<RX14> so don't specify a type restriction
<RX14> it's as easy as that
<FromGitter> <5minpause> you are right, that is a possible answer. thank you
hightower2 has joined #crystal-lang
alex`` has quit [Ping timeout: 258 seconds]
<FromGitter> <pnloyd> @RX14, are you going to keep comicating
<RX14> ??
<FromGitter> <pnloyd> Gitter.. :-/.. ⏎ Are you going to keep communicating with the scala dev? I apologize I'm just super interested in the performance gains.
<RX14> well i said I'm not really interested on working on it
<FromGitter> <pnloyd> I'm really hopeing he stay's interested in opening up their GC.
<FromGitter> <pnloyd> Gitter..
<FromGitter> <pnloyd> Well you don't have to work on it, just show him that Crystal is interested.
<FromGitter> <pnloyd> Or tell him, however.
<RX14> i said, i'll gladly accepr PRs
<RX14> and maybe after 1.0 it will become a priority to work on
<FromGitter> <pnloyd> That does not does very interested.
<FromGitter> <pnloyd> Did you look at those benchmarks!?!
<RX14> yes
<FromGitter> <pnloyd> It opens up so many use cases
<RX14> and its cool
<RX14> no it doesn't
<FromGitter> <pnloyd> Well at least a handful..
<FromGitter> <pnloyd> It doesn't take much work to show interest.
<RX14> windows will open many more
<RX14> and parallelism will open many more
<RX14> they're much more important
<RX14> i'd rather spend my time on them if I had time
<FromGitter> <pnloyd> Ya parallelism is bigger, but this is an easy win. That guy is a PhD student being pad full time to do the work his does. Showing him does some appreciation that results in him taking interest in the project would result in more "wins" per effort on implementing parallelisms.
<FromGitter> <pnloyd> You can say "thanks bro for making our GC 300% better" 10000x faster than you can implement any of those other items.
<Yxhuvud> One thing that hasn't been answered that I've seen is if immix supports internal pointers (ie pointers into other objects. think subslices). But then there seems to be some conservative variants of it: https://www.cs.utexas.edu/users/mckinley/papers/conservative-gc-oopsla-2014.pdf
alex`` has joined #crystal-lang
Bish has quit [Ping timeout: 268 seconds]
Bish has joined #crystal-lang
<RX14> @pnloyd if it's important to you it's up to you to spend your time working on it
<RX14> that's how open source works
<FromGitter> <codem4ster> hi all I'm getting some error while compiling a crystal program on ubuntu 16.04, it looks like this; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a05b7d6f7299e8f53973c2a]
<FromGitter> <codem4ster> I searched but can only find `--link-flags='-lyajl'` and this doesn't work already.
<FromGitter> <sdogruyol> do you have libssl-dev installed ?
<FromGitter> <codem4ster> yep
snsei has joined #crystal-lang
<FromGitter> <maiha> @codem4ster Are you creating crystal binding for YAJL? I love YAJL! I'd like to try to compile it. Can I get your code?
<FromGitter> <codem4ster> nope
<FromGitter> <codem4ster> I'm not binding YAJL
<FromGitter> <codem4ster> I'm just using this https://github.com/datanoise/mongo.cr shard
<FromGitter> <codem4ster> before I added this
<FromGitter> <codem4ster> my code compiles
<FromGitter> <codem4ster> after libmongoc-dev something goes wrong
<FromGitter> <codem4ster> it compiles successfully on archlinux
<FromGitter> <codem4ster> but not on ubuntu
<FromGitter> <maiha> I see. I'll try it on ubuntu. Crystal version?
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <codem4ster> Crystal 0.23.1 [e2a1389] (2017-07-13) LLVM 3.8.1
<FromGitter> <codem4ster> strace -f -s 128 crystal deps build --link-flags='-lyajl' 2>&1 |grep '"cc ' ⏎ [pid 19445] execve("/bin/sh", ["/bin/sh", "-c", "cc \"${@}\" -o '/var/www/ht_mobile/bin/ht_mobile' -lyajl -rdynamic -lcrypto -lbson-1.0 -lz `command -v pkg-config > /dev/null && "..., "--", "_main.o", "S-lice40U-I-nt841.o", "P-ointer40U-I-nt841.o", "A-rgumentE-rror.o", "C-allS-tack.o", "A-rray40P-ointer40V-oid4141.o",
<FromGitter> ... "P-ointer40P-ointer40V-oid4141.o", "E-xception.o", "P-ointer40L-ibU-nwind5858E-xception41.o", "U-I-nt64.o", "U-I-nt8.o", "A-rray40S-tring41.o", "P-ointer40S-tring41.o", "S-taticA-rray40I-nt8443225641.o", "P-ointer40I-nt841.o", "I-nt32.o", "P-ointer40V-oid41.o", "F-iber.o", "T-hread.o", "S-et40T-hread41.o", "H-ash40T-hread4432N-il41.o" ... [https://gitter.im/crystal-lang/crystal?at=5a05beb2b20c642429b0dacf]
<FromGitter> <codem4ster> this is the information I can gather
<FromGitter> <codem4ster> I learned from this guy ⏎ https://github.com/crystal-lang/crystal/issues/4825
<FromGitter> <maiha> thanks. I'll try it.
<FromGitter> <Sevensidedmarble> does anyone know how to use a struct from a c header as a type in a c fun binding?
<FromGitter> <Sevensidedmarble> I'm trying to bind a function called setpgid(pid_t pid, pid_t pgid)
<FromGitter> <Sevensidedmarble> that pid_t struct comes from a c header in linux called unistd.h
<FromGitter> <Sevensidedmarble> I thought this would work: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5a05c056d6c36fca31fe505f]
<FromGitter> <Sevensidedmarble> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a05c065f257ad91097ad000]
<FromGitter> <Sevensidedmarble> but it does not
<FromGitter> <Sevensidedmarble> do I have to bind that struct explicitly before I can use it as a type?
<FromGitter> <Sevensidedmarble> also does it need to be unistd.h?
hightower2 has quit [Ping timeout: 248 seconds]
snsei has quit [Remote host closed the connection]
<FromGitter> <Sevensidedmarble> I see theres also @[Include] but no documentation on it
<FromGitter> <petoem> @Sevensidedmarble Using this https://github.com/crystal-lang/crystal/blob/master/src/lib_c/x86_64-linux-gnu/c/sys/types.cr#L16 type might work. ⏎ e.g. `fun setpgid(pid : PidT, pgid : PidT) : Int32`
<FromGitter> <Sevensidedmarble> Thanks @petoem !
<FromGitter> <Sevensidedmarble> the compiler found that type
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vFav1
<crystal-gh> crystal/master 4b6f1c1 Joakim Reinert: Add custom extension support for Tempfile (#5264)
<FromGitter> <Sevensidedmarble> any chance of a setpgid api being exposed?
<FromGitter> <Sevensidedmarble> theres a method to get it right from crystal but not to set it
<FromGitter> <Sevensidedmarble> I could write a pull request
mbarbar has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
<FromGitter> <maiha> @codem4ster Compiled successfully in ubuntu-16.04 without any other arguments like `-lyajl`.
snsei has quit [Remote host closed the connection]
<FromGitter> <maiha> I guess you've install `libyajl-dev` package too, and `-lyajl` causes confliction. I just installed `mongo-c-driver-1.1.0`, and run `ldconfig`, then `shards update` works well.
snsei has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
snsei has quit []
<hightower3> How do I create an alias/type for the whole thing (like, to be able to write {} of MyType instead of e.g. {} String => String)
<FromGitter> <bew> You can't with this syntax, for hashes you always need to specify separately the key type and the value type.
<hightower3> So my best bet is class MyType < Hash(String,String)
<FromGitter> <bew> But you can `alias MyHash = Hash(String, MyType)` and use `var = MyHash.new`
<hightower3> oh perfect
<hightower3> ++
<FromGitter> <bew> Mixed your example, should be `alias MyType = Hash(String, String)` but you get the idea ;)
<hightower3> right, sure
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
<FromGitter> <yxhuvud> You can, unless any of the types are generic
faustinoaq has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
edo has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<edo> I can't install Crystal on Linux, can someone help me?
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<edo> I can't install Crystal on Linux, can someone help me?
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<edo> I can't install Crystal on Linux, can someone help me?
snsei has quit [Remote host closed the connection]
edo has left #crystal-lang [#crystal-lang]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> @edo please don't spam
<FromGitter> <sdogruyol> what's your distribution? what's your issue? that may help..
<Papierkorb> edo already left
<FromGitter> <sdogruyol> lol
<FromGitter> <sdogruyol> that's rude
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
claudiuinberlin has joined #crystal-lang
<hightower3> Is there a shorthand like in Ruby .map( &:strip) ?
<FromGitter> <sdogruyol> yeah
<hightower3> What's the syntax, the above doesn't work
<hightower3> Looks like with "."
<FromGitter> <Fryguy> `.map &.strip`
<FromGitter> <Fryguy> you can also pass params to that secondary call if it takes them... `.map &.chomp(",")`
<robacarp> that's a handy thing to know
<FromGitter> <unreadable> haha, that's the solus guy.. don't tell me you still couldn't install it lol
<FromGitter> <EdoardoLaGreca_twitter> hey guys, can someone help me?
<faustinoaq> @unreadable Do you also use Solus?
<FromGitter> <unreadable> yeah man, the only distro that didn't make change my os
<FromGitter> <EdoardoLaGreca_twitter> I have some troubles with installation
<FromGitter> <unreadable> had a lot of troubles with ubunut, gnome and so on
<FromGitter> <unreadable> especially with the graphics and some kernel issues
<faustinoaq> I'm using Manjaro Linux and I really happy using it :)
<FromGitter> <unreadable> maybe I'll switch to ubuntu budgie or arch one day, but that would require solus to crash
<FromGitter> <EdoardoLaGreca_twitter> https://pastebin.com/kw6V1Yr8 this is the output of ```make specs```
<faustinoaq> I just need to do `sudo pacman -S crystal` It's on official repos :)
<FromGitter> <unreadable> it would be nice to be added on solus too
<FromGitter> <unreadable> I've seen Nim is added
<faustinoaq> +1
<FromGitter> <EdoardoLaGreca_twitter> can someone consider me?
<FromGitter> <unreadable> budgie ubuntu seems to beautiful
<FromGitter> <unreadable> what's you problem man?
<FromGitter> <unreadable> now I see
<FromGitter> <EdoardoLaGreca_twitter> I have troubles with installation
<FromGitter> <EdoardoLaGreca_twitter> I use Solus so I had to compile all
<FromGitter> <unreadable> what version?
<FromGitter> <EdoardoLaGreca_twitter> Solus 3
<FromGitter> <ylluminate> anyone considered writing a jupyter kernel for crystal? (https://jupyter.org)
<FromGitter> <unreadable> lol, I meant crystal version
<FromGitter> <EdoardoLaGreca_twitter> oh
<FromGitter> <ylluminate> i figured that the ruby kernel could be used as a base: https://github.com/SciRuby/iruby
<FromGitter> <unreadable> I'm using 0.23.1, go with that
DTZUZO has quit [Ping timeout: 260 seconds]
<FromGitter> <unreadable> haven't switch to 24
<FromGitter> <EdoardoLaGreca_twitter> I think I'm using the last version
<oprypin> ylluminate, are u being serious right now
<FromGitter> <EdoardoLaGreca_twitter> I'm waiting for a response
<Papierkorb> lol
<oprypin> EdoardoLaGreca_twitter‎, i mean you can scroll up by 20 hours and see our conclusion "uninstall solus"
<Papierkorb> and some minutes before that a different solution
<FromGitter> <EdoardoLaGreca_twitter> what if I wanna keep solus as my os?
<FromGitter> <unreadable> no man, don't uninstall it. Go against the water
<FromGitter> <EdoardoLaGreca_twitter> very helpful -_-
<FromGitter> <unreadable> > **<oprypin>** EdoardoLaGreca_twitter‎, i mean you can scroll up by 20 hours and see our conclusion "uninstall solus" wth, uninstall an operating system just because he couldn't install a compiler?
<FromGitter> <unreadable> rip quote
<FromGitter> <unreadable> tl;dr: It's not worth it to uninstall the whole os just because the compiler is not working
<FromGitter> <EdoardoLaGreca_twitter> I know
<FromGitter> <unreadable> clone the .23.1 repo and follow the steps
<FromGitter> <EdoardoLaGreca_twitter> already done
<oprypin> just because the system, for no reason but incompetence, changes a parameter that is the same on every other Linux distro, thus breaking things
<Papierkorb> lul there was a solution posted yesterday already
<Papierkorb> finding it left as excercise to the reader
<FromGitter> <unreadable> the windows api for gui programming is not bad at all
<FromGitter> <unreadable> wondering if linux has something like this
<oprypin> both windows and Linux API are atrocious
<oprypin> Linux also fragmented now
<Papierkorb> linux api for gui..?
<FromGitter> <EdoardoLaGreca_twitter> there is GTK
<oprypin> that would be x11 in my view
<FromGitter> <EdoardoLaGreca_twitter> or wxWidgets
<Papierkorb> unreadable, um there's no native gui toolkit or even API on linux
<FromGitter> <EdoardoLaGreca_twitter> > **<oprypin>** just because the system, for no reason but incompetence, changes a parameter that is the same on every other Linux distro, thus breaking things
<FromGitter> <EdoardoLaGreca_twitter> how can I change this parameter?
<Papierkorb> sometimes I think I'm on the blocklist of many
<oprypin> recompiling gcc probably
<FromGitter> <unreadable> Fk it, I'ma start writting a sdl2 based gui lib..
<oprypin> Papierkorb, you out of all people? no way
<oprypin> or you mean that it feels that way
<Papierkorb> you're not on mine either
<Papierkorb> Of course it feels like it, even it was the case (I'd guess that most don't even know how to or don't bother?), I'd never know.
wontruefree has joined #crystal-lang
<FromGitter> <EdoardoLaGreca_twitter> I think I'll go to stack exchange and ask for a solution to my problem
<FromGitter> <sdogruyol> Compiling gcc takes more than an hour on an i7
<FromGitter> <sdogruyol> Feels like eternity
<faustinoaq> @unreadable I don't get it, Two persons are having problems installing crystal on solus, but you compiled crystal on solus successfully, Why Are they doing wrong?
<faustinoaq> s/Why/What/
<FromGitter> <unreadable> Idk, let's just end this. It's becoming annoying
<oprypin> i mean you cant just end it, we still have 2 people hanging
<FromGitter> <EdoardoLaGreca_twitter> we just need to know HOW did it install it
<FromGitter> <unreadable> I've just followed the steps..I can't remember exactly if I did some changes since it's been some time
<Papierkorb> Are the OS versions equal? Is some important packet simply toast for those affected? (Maybe clang or llvm)
<Papierkorb> And/or were any related packages (like clang or llvm) installed from source (or somewhere else), or did everyone install it from the solus repository
<oprypin> dont forget gcc^
<oprypin> in fact, from what i've seen so far, the easiest and most useful thing for @unreadable to do is to post the output of `gcc -v`
<FromGitter> <EdoardoLaGreca_twitter> I installed llvm and clang from eopkg
<FromGitter> <watzon> I feel like I've seen this issue before where everything builds, but prelude fails to load
<FromGitter> <watzon> What lib is `c/dlfcn`?
<oprypin> c
<oprypin> what happens is that the OS is not detected as "linux" but as "solus" because it's a unique snowflake
<FromGitter> <EdoardoLaGreca_twitter> https://pastebin.com/ejB5uxuP ```gcc -v```
<oprypin> and crystal doesnt have support for "solus"
<oprypin> doesnt have libc bindings for it
<FromGitter> <watzon> Is there any way to make Crystal see it as Linux then?
<oprypin> oh right, it's probably not 2 people. is 'edo' == 'EdoardoLaGreca_twitter‎' ?
<FromGitter> <watzon> Most likely
<Papierkorb> Would be a kinda weird coincidence if not lul
<FromGitter> <EdoardoLaGreca_twitter> @watzon idk what is c/dlfcn
<FromGitter> <EdoardoLaGreca_twitter> @FromIRC yep, I'm from gitter now
<FromGitter> <watzon> Apparently a dynamic linking library
<oprypin> doesnt matter what it is, the whole lib_c is missing, it just happens to be first
<FromGitter> <watzon> Ahh gotcha
<FromGitter> <unreadable> `gcc version 7.1.0 (Solus)`
<oprypin> all of it
<FromGitter> <EdoardoLaGreca_twitter> did someone find the solution?
<FromGitter> <watzon> oprypin are you looking for this? https://pastebin.com/ejB5uxuP
<Papierkorb> that gcc version is much more recent than what edo posted
<oprypin> watzon‎, i am looking for the equivalent from @unreadable
<FromGitter> <watzon> Oh that's true
<FromGitter> <unreadable> I've installed crystal some time ago and I can't guarantee I've done it on gcc 7.1.0
qard has joined #crystal-lang
<FromGitter> <watzon> I will go above and beyond here. Let me get a Solus install up and running so I can do some testing
A124 has quit [Ping timeout: 258 seconds]
A124 has joined #crystal-lang
<FromGitter> <watzon> I've got to say, the Solus install process is very simple
A124 has quit [Ping timeout: 248 seconds]
<oprypin> aand he was never seen since
<FromGitter> <watzon> Lol
<hightower3> Oh man remind me, what's the keyword for read-only property
wontruefree has quit [Ping timeout: 258 seconds]
<RX14> getrer ?
<RX14> getter*
<RX14> there's getter/setter/property
<hightower3> ah god, yeah, was trying with 'reader'
<RX14> clearly you came from ruby haha
<FromGitter> <marksiemers> Can crystal bind to C++ the way it can do C bindings?
<Papierkorb> you mean with a simple `lib` binding? Not in the general case, no
<RX14> C++ mangles identifier names and it's not standardized at all how the mangling is done
<RX14> so it's basically impractical to implement it in lib
<RX14> you have to write a small wrapper in C++ that exports it in c, and Papierkorb has written a project to do ecactly that automagically
<FromGitter> <marksiemers> on GH?
<Papierkorb> [* with an appropriate, user-written configuration file]
<FromGitter> <marksiemers> I had a thought that binding to ulib's postgres functions might be a way to get a fast db driver.
<FromGitter> <marksiemers> Does that sound like a fool's errand?
<Papierkorb> Actually it does
<Papierkorb> What you actually want is that the DB driver to be integrated with libevent
<Papierkorb> You get this for free if you implement it in Crystal
<Papierkorb> Some (rare?) C library may also offer integration, so that's also an option
<FromGitter> <sdogruyol> pg is already written in crystal?
<Papierkorb> And that too.
<FromGitter> <marksiemers> There is `crystal-pg` of course and `crystal-db` - but they benchmark relatively low on the TFB tests. If it was (sort of) easy to experiment with ulib (which benchmarks in the 97th percentile), I thought it might be worth a shot
<Papierkorb> What you actually want is a libevent native implementation, so that it won't block the thread and just a fiber
<FromGitter> <marksiemers> Is that something that would be baked into the db driver(s) or should it be done in each app using them?
<FromGitter> <sdogruyol> I'm pretty sure crystal-db and pg has some low hanging fruits to optimize
<Papierkorb> I mean you can try, just that even if it's really fast, it's not that useful in the general case
<FromGitter> <sdogruyol> we need more to contribute to those
<Papierkorb> ^
<Papierkorb> Maybe you can scavenge some ideas from that ulib though
<FromGitter> <sdogruyol> @marksiemers it's great to see your interest in performance, may I ask what's your specific use case?
<FromGitter> <marksiemers> My C++ has 9 years of rust and was never that good in the first place, if anyone is more familiar - this I think is a starting point: ⏎ https://github.com/stefanocasazza/ULib/blob/cef30bb4e041cc5f16dbe96d01988c7e247088d6/src/ulib/orm/driver/orm_driver_pgsql.cpp
<RX14> @marksiemers have you benchmarked crystal-pg directly?
<RX14> if not, do that *first* before even attempting optimization
<RX14> bench it against go and a C pg driver or whatever you want
DTZUZO has joined #crystal-lang
<FromGitter> <marksiemers> @sdogruyol - I plan to evangelize crystal (and amber). For any developer or company doing web or api apps, if they are going to make the switch - they are going to care about db performance and published db performance at that (over plaintext).
<FromGitter> <sdogruyol> that's great to hear
<FromGitter> <sdogruyol> I've been evangelizing Crystal for more than 2 years now. It's great to see more interested in doing so
<FromGitter> <marksiemers> RX - that's a good point, I have not. I'm just assuming since plaintext and JSON serialization are relatively fast with crystal-raw, that HTTP::Server is not the bottleneck in the TFB tests - then crystal-db and crystal-pg seemed the next logical place.
<RX14> don't assume
<RX14> benchmark
<FromGitter> <marksiemers> Agreed, I guess that means setting up ulib locally to get an apples-to-apples comparison
<RX14> or just something simple like go's pg driver
<RX14> bench apples to apples
<FromGitter> <sdogruyol> An easier might be just starting out with go, or node
<RX14> if we're 3x slower than go you don't need to bench ulib
<FromGitter> <sdogruyol> or maybe rust
faustinoaq has quit [Quit: Konversation terminated!]
<RX14> you know we suck
<FromGitter> <marksiemers> @sdogruyol - Yeah other than exercism, kemal was definitely the first way I used crystal.
<FromGitter> <sdogruyol> glad to hear that
<FromGitter> <marksiemers> Yeah, with the idea of binding to Ulib out the window, benching against those others makes more sense
<FromGitter> <marksiemers> I just feel dirty writing in Go
faustinoaq has joined #crystal-lang
<RX14> i've never written go
<FromGitter> <sdogruyol> I haven't written any production stuff but read lots of go code
<RX14> well you can read go without trying
<FromGitter> <sdogruyol> %30 of them being if err != nil
<RX14> it's just obvious
<FromGitter> <sdogruyol> no
<RX14> like C and most of C++
<FromGitter> <sdogruyol> I don't agree with that
<FromGitter> <sdogruyol> C is easier to read
<RX14> not sure about that
<RX14> try reading an unnamed function pointer definition or any complex type definition in C
<FromGitter> <Sevensidedmarble> I think go is much messier looking then c
<RX14> stuff like **foo()[5]()
<RX14> what the fuck does that mean, it's probably valid C
<FromGitter> <sdogruyol> I'm happy with Crystal
<FromGitter> <sdogruyol> let's make it mainstream already :)
<RX14> i think go looks about the same as C
<FromGitter> <Sevensidedmarble> is there much documentation on the whole LibC thing?
<FromGitter> <marksiemers> Given when it was developed (after ruby, python, and others), it seems Go was written by syntax masochists
<RX14> its much nicer to use go at least
<RX14> it was written by hardcaord C programmers
<RX14> i.e. the plan 9 guys
<FromGitter> <marksiemers> @Sevensidedmarble - Have you walked through this part of the docs? ⏎ https://crystal-lang.org/docs/syntax_and_semantics/c_bindings/
<FromGitter> <Sevensidedmarble> I have
<FromGitter> <sdogruyol> Crystal is a beauty :P
<FromGitter> <sdogruyol> we just need to make generics work better hehe
<FromGitter> <Sevensidedmarble> it doesnt mention LibC in much detail
<RX14> @sdogruyol you seem to never have anything bad to say about crystal lol
<FromGitter> <Sevensidedmarble> crystal is beautiful though yes
<FromGitter> <sdogruyol> I actually say a lot of negative stuff too :P (not here though)
<RX14> i just moan about crystal here lol
<FromGitter> <sdogruyol> but hey, let's keep those for later and focus on the good parts first
<FromGitter> <marksiemers> With a lot of languages, coming from ruby, you trade off ease of development and syntax for performance. ⏎ I actually like crystal MORE than ruby - method overloading and the compiler stops me from being dumb quite a bit
<Papierkorb> RX14: (͡° ͜ʖ ͡°)
<RX14> no, you focus on the worst parts now because that's optimal for reducing the badness of crystal before 1.0
<RX14> Papierkorb, shh
<FromGitter> <sdogruyol> @RX14 ah yeah, the core team focuses on the worst first :P
<RX14> i love crystal way more than ruby, it's ruby without the bad bits
<RX14> i've pretty much always used statically typed languages
<Papierkorb> basically ^
<FromGitter> <marksiemers> Except that `Hash#key?` method. lol.
<RX14> i mean it makes sense
<RX14> hash.key(value)
<FromGitter> <sdogruyol> Crystal is Ruby with a correct "English grammar"
<RX14> then you need a nil-returning version
<FromGitter> <sdogruyol> I still go back to Ruby and confuse "exist?" lol
<RX14> @sdogruyol it's more than that lol
<FromGitter> <sdogruyol> ofc, it's
<FromGitter> <sdogruyol> also no alias hell here
<FromGitter> <marksiemers> I was more laughing cause I had no idea that issue would turn into such a lengthy discussion: https://github.com/crystal-lang/crystal/issues/5248
<FromGitter> <sdogruyol> @RX14 you didn't come from Ruby background?
<FromGitter> <Rinkana> I was reading back and saw something about libevent. What is the best way to utilize that in my crystal app? It is already event based by having a few fibers read and write to the same deque.
<Papierkorb> Rinkana, I/O goes through it by default, you don't have to do anything to benefit from it
<RX14> @sdogruyol not at all
<RX14> i've not written much ruby at all
<RX14> i've written much more java than ruby
<RX14> maybe even more groovy than ruby
<RX14> lol
<RX14> i've also never used rails
<Papierkorb> matz, our lord and favorite japanese programmer
<Papierkorb> ah you didn't miss much *runs*
<RX14> yeah lol
<RX14> rails was really the first big web framework
<RX14> and with no previous work it's bound to be shit
<FromGitter> <Rinkana> And yet, most that follow still suck more
<RX14> we all stand on the shoulders of giants
<RX14> rails is one of them but it has it's fair share of mistakes
<RX14> like all of activerecord
<RX14> and all of activesupport
<Papierkorb> AR is shit, Sequel is the shit
<Papierkorb> Roda too <3
<Papierkorb> RX14: Well the most interesting parts of active support are part of the stdlib lul
<FromGitter> <watzon> Ok I give up
<FromGitter> <watzon> Solus in not working well in Vitrualbox or gnome-boxes
<FromGitter> <watzon> FTS
<RX14> Papierkorb, yeah in crystal
<FromGitter> <Rinkana> That's the worst thing, you always wonder if the function is nave ruby or rails.
<Papierkorb> Well that's the fault of the programmer really
<Papierkorb> With pry it's trivial to look that up
<Papierkorb> if you're not sure and too lazy to check the docs (All rails docs websites suck), or simply fire up a pry/irb and try it in there
<Papierkorb> -or
<FromGitter> <Rinkana> Too bad it's impossible for crystal to have a binding.pry equivalent. Thats one of the better features of an interpreted language.
<RX14> i have a feeling that perhaps a crystal interpreter would work
<RX14> but thats a massive and impressive undertaking
<FromGitter> <marksiemers> Yeah, like Ch for C and C++
<Papierkorb> RX14: not required
<Papierkorb> (ab)use debugging data to locate locals, then patch user code into the program and run
<RX14> what about complete hot reload?
<Papierkorb> loses the state, nah
<Papierkorb> Also you can't be sure the code under you will have the same address after the fact
<FromGitter> <drosehn> Many years ago I worked on a platform which had "Interactive Fortran". Very nice interactive and editing capabilities. Given that I've seen that done for Fortran, the same thing could be done for any compiled language. However, the environment is different enough that you'd basically have to write the entire thing from scratch. It's a massive amount of work. InteractiveFortran shared no code with the
<FromGitter> ... fortran compilers available for the same platform.
<FromGitter> <drosehn> Well, "environment" isn't the right idea. "requirements for an interactive version" would be better.
<faustinoaq> Hey latest JavaScipt isn't bad, in fact TypeScript & JavaScript are doing very good :)
p0p0pr37 has quit [Remote host closed the connection]
<Papierkorb> -not
p0p0pr37 has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <EdoardoLaGreca_twitter> > Solus in not working well in Vitrualbox or gnome-boxes
<FromGitter> <EdoardoLaGreca_twitter> and so I will remain without crystal?
snsei has quit [Ping timeout: 240 seconds]
alex`` has quit [Ping timeout: 258 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<faustinoaq> @EdoardoLaGreca_twitter please try to install crystal in other distro and see if your installation issue disappear, just for a while :)
<FromGitter> <faultyserver> I've been thinking recently about how something like ICR could be implemented better, kinda getting at the "interpreted crystal" idea
<FromGitter> <faultyserver> the main thing I think that needs is incremental compilation
wontruefree has joined #crystal-lang
<FromGitter> <faultyserver> haven't put too much thought into what it would actually take, or how that would look
<FromGitter> <faultyserver> but incremental compilation could help avoid the current "memorize the old output, then subtract it from the new output" thing
<FromGitter> <faultyserver> it'd be a fun problem to waste a month on :)
wontruefree has quit [Ping timeout: 240 seconds]
<faustinoaq> :)
faustinoaq has quit [Quit: Konversation terminated!]
snsei has joined #crystal-lang
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
snsei has quit [Remote host closed the connection]
DTZUZU has joined #crystal-lang