RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
marmotini_ has joined #crystal-lang
<FromGitter> <mniak> I'm doing well. I got to know crystal last week and I'm hypnotized!
<FromGitter> <mniak> So I'm doing very well
<FromGitter> <Blacksmoke16> what does the `::` represent when in front of a class name/
<FromGitter> <Blacksmoke16> like `::Nil`
<FromGitter> <dscottboggs_gitlab> that means it's part of the top-level namespace
<FromGitter> <dscottboggs_gitlab> incase you had a custom Nil class that would get discovered before ::Nil
<FromGitter> <Blacksmoke16> πŸ‘ thanks
<FromGitter> <dscottboggs_gitlab> `::` In general is used to denote that something is a part of something else, be it a class or a module.
<FromGitter> <dscottboggs_gitlab> np
marmotini_ has quit [Ping timeout: 252 seconds]
<FromGitter> <Blacksmoke16> is there a way to inherit method doc from a parent?
<FromGitter> <Blacksmoke16> i.e. if i have an abstract class with an abstract def that i put the comment on, that all subclasses would have the same comment
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/5759 already an issue for it it seems
marmotini_ has joined #crystal-lang
<FromGitter> <girng> @dscottboggs_gitlab and @fridgerato good, thank you for asking
<FromGitter> <girng> @mniak Haha nicee
marmotini_ has quit [Ping timeout: 252 seconds]
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5avh
<FromGitter> <Blacksmoke16> humm
marmotini_ has joined #crystal-lang
<FromGitter> <sam0x17> is there a while loop variant that takes a block? I want to do a one line while loop
<FromGitter> <sam0x17> I guess I could use semicolons, but that's ugly
<FromGitter> <mniak> it's just a guess, but the idea could work: ⏎ ⏎ ```whileblock condition do puts("hello") end``` [https://gitter.im/crystal-lang/crystal?at=5bce8642435c2a518eed4aa4]
<FromGitter> <proyb6> I’m looking for alternative way to improve looping performance which you know β€œwhile” took longer than other keyword
<FromGitter> <sam0x17> ended up with something like that, though the construction I keep repeating is something like "if, while, finally" ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5bce875ac08b8b30675969ef]
<FromGitter> <sam0x17> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bce87786e5a401c2db59e8a]
<FromGitter> <sam0x17> I have like 25 of these (writing a compiler) so nice having a one-liner for that construction
<FromGitter> <sam0x17> `finally` only executes if the condition was true at least once
<FromGitter> <dscottboggs_gitlab> I like it
zorp has quit [Ping timeout: 264 seconds]
<FromGitter> <sam0x17> thx :)
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 do you think this will work? https://github.com/crystal-lang/crystal/pull/6981
<FromGitter> <Blacksmoke16> no idea, can give it a try, sec
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bce950d069fca52a57c0db6]
<FromGitter> <Blacksmoke16> found a typo :)
<FromGitter> <Blacksmoke16> also ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bce959f1c100a4f29cbfd4e]
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 ack I knew I'd get one in one of those haha thanks
<FromGitter> <dscottboggs_gitlab> how are you just trying this?
<FromGitter> <Blacksmoke16> pull down your branch and try to compile crystal
<FromGitter> <Blacksmoke16> is prob related to `@type.constants.find { |cnst| cnst === @const }.try &.doc` since this can return Nil when it should only return a `Crystal::Doc::Type`
<FromGitter> <dscottboggs_gitlab> oh, I thought that was nillable
<FromGitter> <Blacksmoke16> ` getter type : Crystal::Type` naw looks like its not
<FromGitter> <dscottboggs_gitlab> I'll take another look at it a little while later or tomorrow. thanks.
<FromGitter> <dscottboggs_gitlab> I haven't yet compiled my own crysta
<FromGitter> <Blacksmoke16> er wait think that was the wrong ivar, but yea it cant be nil, or at least needs to be checked if its nil or not
<FromGitter> <Blacksmoke16> might help :p
<FromGitter> <Blacksmoke16> np
<FromGitter> <Blacksmoke16> am sure will have some comments from others on your PR, thanks for taking this up, will be quite handy when its all done
notdaniel has quit [Quit: Textual IRC Client: www.textualapp.com]
marmotini_ has quit [Ping timeout: 240 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<FromGitter> <vladfaust> Guys, do you know if Stripe invested into Crystal on early stages?
RX14 has quit [Quit: Fuck this shit, I'm out!]
Vexatos has quit [Quit: ZNC Quit]
RX14 has joined #crystal-lang
emilsp is now known as slimep
RX14 has quit [Quit: Fuck this shit, I'm out!]
royisbatty has joined #crystal-lang
<FromGitter> <vladfaust> I've the account unblocked :D Subscribe to never miss a Job - https://twitter.com/crystaljobsorg
RX14 has joined #crystal-lang
royisbatty has left #crystal-lang [#crystal-lang]
<FromGitter> <sdzyba> @vladfaust not sure about relationships between Stripe and Crystal, but they're investing a lot to implement a type checker for Ruby. Maybe worth spreading information about Crystal among Stripe devs
<livcd> sdzyba: are you sure it's a lot ?
<livcd> is not it just couple of devs ?
<FromGitter> <Heaven31415> I found some info, it was built by 3 ppl, you can check it here: https://sorbet.run/
<FromGitter> <sdzyba> A couple of professional devs sounds a lot to me :)
<FromGitter> <Heaven31415> A message from them which appeared in May of this year, stated that they worked for 9 nine on it (at that time, so it's probably over a year now)
marmotini_ has joined #crystal-lang
<FromGitter> <sdzyba> If they spent the same resources on Crystal development the impact might be very significant
marmotini_ has quit [Ping timeout: 240 seconds]
<FromGitter> <anicholson> πŸ‘‹
<FromGitter> <anicholson> I'm having a bit of frustration with ECR at the moment
<FromGitter> <anicholson> I have a shard that uses ECR to render a default error message to a String
<FromGitter> <anicholson> but when I attempt to compile a project that's using that shard, the compile fails because the ECR macro can't find the right file.
<FromGitter> <anicholson> It doesn't appear that I can use `File.join(__DIR__, "error_template.ecr")` in the macro call
<FromGitter> <anicholson> how can I get around this issue?
<FromGitter> <mjbunink> Hi all, does Crystal have openGl bindings or 2d/3d shards yet?
zorp has joined #crystal-lang
<FromGitter> <fridgerator> https://crystalshards.org/?filter=opengl
<FromGitter> <fridgerator> also searches for "2d" and "3d" turn up results
<FromGitter> <vladfaust> @anicholson use the path assuming it's called from an application requiring that shard. E.g. `"myshard/templates/error.ecr"`. It will be untestable though. To avoid this, you can set up macro variable, which would change the path in the compile time to something like `"../src/myshard/src/templates/error.ecr"`
<FromGitter> <vladfaust> Also IIRC there was an issue regarding to `File.join` in macros
<FromGitter> <vladfaust> Guys, if you can afford it, take a look at my Patreon. I misplanned my time and now have a financial gap between my next project (crystal-based and promoting it) and present time. I'm not sure I'll be able to pay for my apartment this month πŸ˜… Thanks! https://www.patreon.com/vladfaust
nekocentral has joined #crystal-lang
<nekocentral> what would be the best way to convert this command to a crystal thing
<nekocentral> "cat /proc/version | cut -d' ' -f 3"
ua has joined #crystal-lang
<FromGitter> <straight-shoota> `` `cat /proc/version`.split[2] ``?
ua_ has quit [Ping timeout: 252 seconds]
<nekocentral> yea and replaced cat with File.read
<nekocentral> ty
nekocentral has quit [Ping timeout: 252 seconds]
marmotini_ has joined #crystal-lang
<FromGitter> <Heaven31415> Damn , a new @asterite PR, you need to see it!
<FromGitter> <fridgerator> 1) o
<FromGitter> <fridgerator> slowly becoming java
<FromGitter> <fridgerator> j/k
<FromGitter> <straight-shoota> xD
<FromGitter> <bmulvihill> bundle install
<FromGitter> <proyb6> Today I just found Mint Language has an interesting docs ⏎ https://www.mint-lang.com/
<FromGitter> <proyb6> In the project and run ```mint doc``` will give you a handy view on relevant APIs it used, I though Crystal should have this built in feature for any projects!
<FromGitter> <proyb6> ```mint doc``` is a documentation server
Vexatos has joined #crystal-lang
<FromGitter> <bajro17> I find simplest tree implementation
<FromGitter> <bajro17> but there is Node(T)
<FromGitter> <bajro17> when I initialize tree I pass symbol like parameter (Symbol)
<FromGitter> <bajro17> can I avoid this and to all time be symbol because I want only use that
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5b8e
<FromGitter> <Blacksmoke16> is my question of the day :p
<FromGitter> <vladfaust> @Blacksmoke16 https://github.com/crystal-lang/crystal/issues/6757
<FromGitter> <vladfaust> Mention this issue so it has attention of the core team. I need this one as well
<FromGitter> <Blacksmoke16> would be handy
<FromGitter> <schoening> Hey how does crystal deal with requiring files with classes that have the same name? ⏎ Would I have to wrap them in a separate file and import that?
<FromGitter> <straight-shoota> @schoening Crystal has a global namespace. You can't have two classes with the same name.
<Yxhuvud> The normal way to avoid it is to wrap them in module or class namespaces though
<FromGitter> <schoening> Ok :) yeah thats the SO answer I saw on Ruby with the same issue
<FromGitter> <j8r> @Heaven31415 yes, it seems he is in a good mood :)
<FromGitter> <j8r> Is it possible to raise an exception without the backtrace, to avoid the perfomance overhead of dumping the stack?
<FromGitter> <bew> Not builtin
<FromGitter> <Blacksmoke16> any good recommendations for hosting the generated crystal docs for a given repo?
<FromGitter> <Blacksmoke16> github pages maybe?
<FromGitter> <bew> @j8r you could make your own raise method that doesn't attach a callstack to the exception object being raised (not sure how this would last
<FromGitter> <bew> @Blacksmoke16 yes gh pages is good
<FromGitter> <Blacksmoke16> there any setup that needs to be done? or just point it to the docs/ directory?
<FromGitter> <bew> No idea, i remember reading a post or comment somewhere where bcardiff was explaining how to do that
<FromGitter> <Blacksmoke16> πŸ‘ I'll play around with it
<FromGitter> <Blacksmoke16> Thanks
<FromGitter> <j8r> Too bad this isn't this builtin @bew . This will help for performance. Actually everything panic :| I may open an issue on this
<FromGitter> <bew> It's not a lot of code, Exception is made in a way where the callstack is optional
<FromGitter> <bew> But indeed, a `callstack: false` to `raise` would make things simpler
<z64> @Blacksmoke16 Travis can deploy docs for you; i have an example in my repo. can see the travis config here: https://github.com/z64/steam_id/blob/master/.travis.yml#L7-L14 and travis docs: https://docs.travis-ci.com/user/deployment/pages/
<FromGitter> <j8r> Oh ok
<FromGitter> <j8r> Or a nee keyword
<FromGitter> <j8r> *new
<FromGitter> <bew> hmmmaybe (method, not keyword)
<FromGitter> <j8r> I don't see any toggable callstack inhttps://crystal-lang.org/api/master/Exception.html
<FromGitter> <bew> @j8r also, when you don't have a callstack attached, it might be nice to have at least the file:line of where the exception was raised
<FromGitter> <bew> the `@callstack` ivar of `Exception` can be nil
<FromGitter> <j8r> Hum thats the callstack property? For example when parsing, or index out of bound, the callstack is useless
<FromGitter> <j8r> Or may be not always useful
<FromGitter> <bew> how do you decide when it's useless?
<FromGitter> <j8r> If i do a begin rescur that rescue another exception, I won't see the backtrace
<FromGitter> <j8r> 1) of the first one
<FromGitter> <bew> i don't get it, can you give an exemple?
<FromGitter> <j8r> I parse a file, rescue when the parsing fails, then raise that it fails, rescue in the build and raise that the parse fails etc
<FromGitter> <j8r> I just want to know the first callstack, when the parsing fails
<FromGitter> <bew> do you know `cause` argument of `Exception` ?
<FromGitter> <bew> (btw there is missing doc about it..)
<FromGitter> <j8r> That's the message?
<FromGitter> <j8r> `raise "cause"` ?
<FromGitter> <bew> to easily "re-raise" an exception
<FromGitter> <j8r> This avoid dumping the stack again?
<FromGitter> <j8r> That all what I need at the end :)
<FromGitter> <bew> not really: https://carc.in/#/r/5bbv
<FromGitter> <bew> it allows you to see the 2 traces
<FromGitter> <bew> the 1st and 2nd exception
<FromGitter> <j8r> I'll create my own exception without callstack. Thanks @bew !
<FromGitter> <bew> ok sorry for not understanding exactly
<FromGitter> <j8r> The point is: i create exceptions, we know exactly why it fails: no need to dump the stack. For example: "myfile.tgz: download timeout"
<FromGitter> <j8r> Or for the file parsing case: "unknown command: echo"
<FromGitter> <Blacksmoke16> z64, cheers ill take a look
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/6980#issuecomment-432220673 any workaround for this?
<FromGitter> <m-o-e> undefined method 'each' for YAML::Any hummm
<FromGitter> <Blacksmoke16> gotta do `as_a` to tell it it should be an array
<FromGitter> <m-o-e> ohhhh
<FromGitter> <m-o-e> @blacksmoke16 thanks!
<FromGitter> <Blacksmoke16> np, would be `Array(YAML::Any)`
<FromGitter> <bew> @j8r yeah maybe make an issue about that, would be interesting
<FromGitter> <j8r> Before asking i was reading some infos about how Rust and Swift handle exceptions – they use a custom type, and of course panic is still there to raise the stack
<FromGitter> <faustinoaq> Hi crystal community, I'm back, I had taken a long break πŸ˜… I'll continue with some collaborations in my favorite repos πŸ˜„
<FromGitter> <bew> \o/ @faustinoaq
<FromGitter> <j8r> Welcome back @faustinoaq !
<FromGitter> <faustinoaq> Yeah, feels nice to be here again :)
<FromGitter> <fridgerator> hey @faustinoaq
<FromGitter> <jwoertink> Welcome back @faustinoaq πŸ˜„
marmotini_ has quit [Ping timeout: 244 seconds]
<FromGitter> <bajro17> I have question for what is used $1
non-aristotelian has quit [Quit: non-aristotelian]
<FromGitter> <anicholson> > @anicholson use the path assuming it's called from an application requiring that shard. E.g. `"myshard/templates/error.ecr"`. It will be untestable though. To avoid this, you can set up macro variable, which would change the path in the compile time to something like `"../src/myshard/src/templates/error.ecr"` ⏎ ⏎ @vladfaust that feels really gross. I think I'm just going to pull the template into the
<FromGitter> ... file and remove ECR altogether.
<FromGitter> <fenicks> Hi guys
<FromGitter> <fenicks> What the best pattern or idiom in crystal to use something like ticker with `select`. In Gloang it could be done like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bcfb3991e23486b9309696b]
<FromGitter> <Blacksmoke16> switch statement?
<FromGitter> <Blacksmoke16> case*
zorp has quit [Ping timeout: 252 seconds]
<FromGitter> <fenicks> @Blacksmoke16 , Ok for `case`, thnks. An idea for the ticker or the `select` keyword in crystal ?
<FromGitter> <Blacksmoke16> well i dont know Go, but ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ sure looks like a case statement [https://gitter.im/crystal-lang/crystal?at=5bcfb4c51e23486b93096f73]
<FromGitter> <dscottboggs_gitlab> the select statement in go isn't liek a switch-case
<FromGitter> <dscottboggs_gitlab> It looks like it but it functions differently
<FromGitter> <Blacksmoke16> ah
<FromGitter> <dscottboggs_gitlab> @fenicks is crystal going to be able to do that with it's concurrency limitations?
<FromGitter> <Blacksmoke16> https://crystal-lang.org/docs/guides/concurrency.html would want to look into this then
<FromGitter> <Blacksmoke16> might be closer to what you're looking for maybe?