RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | 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
<FromGitter> <j8r> Why hopeless @girng ?
<FromGitter> <j8r> Why dev? (troll) ;)
<FromGitter> <j8r> Nillable rchop? and lchop? will be useful
<FromGitter> <j8r> When parsing text for example
<FromGitter> <j8r> Along with String#[0..9]?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
renich has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> @girng @theretromaniac carc.in is down but play.crystal-lang.org/ is up
<FromGitter> <dscottboggs_gitlab> @j8r what do you mean nillable rchop and lchop? In what case would they return nil?
<FromGitter> <girng> nah it's still down 4 me
<FromGitter> <girng> i tried carc.in too
<FromGitter> <dscottboggs_gitlab> yeah I just checked again and you're right
<FromGitter> <girng> i didn't know how much i relied on it until now lol
<FromGitter> <dscottboggs_gitlab> for what?
<FromGitter> <dscottboggs_gitlab> also, I think `String# (Range)` does the most sensible thing already. If the range exceeds the size of the string, it just truncates it. So you should test the resulting substring for size if you want to check if it was successful (@j8r)
<FromGitter> <girng> just random testing and fiddling around with code haha
<FromGitter> <dscottboggs_gitlab> why not use `crystal play` locally?
<FromGitter> <girng> much faster on the playground
<FromGitter> <dscottboggs_gitlab> It's a bit nicer anyway
<FromGitter> <girng> for me anyway
<FromGitter> <dscottboggs_gitlab> oh?
<FromGitter> <dscottboggs_gitlab> hm. Yeah, idk how I feel about the auto-compiling feature
<FromGitter> <girng> wait does crystal play do? run the own play on a localhost server?
<FromGitter> <dscottboggs_gitlab> yes
<FromGitter> <girng> ohhh wow never knew that was a thing
<FromGitter> <girng> WOW that's cool
<FromGitter> <girng> let me test to see if it'
<FromGitter> <girng> faster*
<FromGitter> <girng> eh about the same speed. ok cool i'll just do crystal play for now
<FromGitter> <girng> thanks @dscottboggs_gitlab
<FromGitter> <dscottboggs_gitlab> yeah no problem, glad you've got a playground to test stuff out in
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <girng> wow gonna start using `pp` more. didn't know it expands a class and shows teh goodies
<FromGitter> <Blacksmoke16> ye
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <dscottboggs_gitlab> hey @girng since carc.in is down here's a paste ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ the point is that basically everything has a `#inspect` method that (unless you override it) does the same thing [https://gitter.im/crystal-lang/crystal?at=5c4540b2ba355012a4704823]
laaron has joined #crystal-lang
<FromGitter> <girng> ic yah
<FromGitter> <girng> rofl i love when this happens. searching for a answer to something, stumble upon it, and crystal uses the same class naming. https://stackoverflow.com/a/20916980/7873241 just had to remove `;` and `var`
<FromGitter> <dscottboggs_gitlab> Yeah, I've noticed a lot of common method names with JS
<FromGitter> <girng> yep same. my fav method name so far has been `chomp` always think of pac man when i use it 😆
renich has quit [Quit: renich]
<FromGitter> <girng> damn want to add my csv to dict code so i don't have to use union types
<FromGitter> <girng> then i have to do `to_s` or or is_a? in code.. i want it to define my own types grrr
Raimondi has joined #crystal-lang
<FromGitter> <girng> if anyone has some time please take a look here: https://paste.ee/p/xP2Jh ⏎ basically i'm trying to make `typeof(Items[2]["type"])` a String only type. since i did `to_s` on it already...
<FromGitter> <girng> basically my ultimate goal is to static type every single csv value
<oprypin> @girng: literally the very first line makes the goal unachievable
<oprypin> and you cannot do this with a loop
<FromGitter> <girng> -_-
<oprypin> and I'll say what I've said before
<oprypin> gotta just write out the code completely manually
<oprypin> `item.item_id = row.to_i` etc etc
<oprypin> before that, you create a class for `item`
<FromGitter> <girng> alright i'll c what i can do
_whitelogger has joined #crystal-lang
<oprypin> but that's very advanced even compared to other macros
<FromGitter> <girng> o lawd
<oprypin> but note that when you use json.parse, you get dicts of unions everywhere. same exact limitation that is useless to try and get around
<FromGitter> <girng> yeah
<oprypin> so it can't be a dict, has to be a class, and it's not possible to automate filling out a class with a normal loop
<oprypin> girng: u can write a simple macro loop tho. `row.each { |item| {% for name, conv in {item_id: "to_i", ... }.items %} if header_name == {{name.stringify}}; obj.{{name.id}} = item.{{conv}}`
<FromGitter> <girng> workin on it
<FromGitter> <girng> ohh
<oprypin> maybe someone can help you finish this cuz i gotta go
<FromGitter> <girng> okay ty, ima gonna c if i can do this
asterite has quit [*.net *.split]
asterite has joined #crystal-lang
<FromGitter> <girng> YO, i think i got it!
<FromGitter> <girng> https://paste.ee/p/STi1o
<FromGitter> <girng> so i refactor a lot of stuff and use unions and type .to_s or use is_a?, or use this code... lol not sure tbh.
<FromGitter> <girng> i like this way because it feels more proper.. value types are static. but i think my code is a mess...
<oprypin> yeah that's perfect!
<oprypin> now it's in the perfect shape to add macros if needed
<oprypin> https://bpaste.net/ has Crystal highlighting btw
<FromGitter> <girng> damn, paste.ee used to highlight crystal too. might have to move bpaste
<FromGitter> <girng> btw thank you. i like this better instead of unions. but unions make it so simple and easy lol
<FromGitter> <girng> but i guess. the more knowledge you have... yeah u get my poinot
<FromGitter> <j8r> @dscottboggs_gitlab i want to rchop/lchop if a string starts/ends with. But internally, that's what they do. Either the starts/ends wirh check is done twice or I do a non optimal `if (substring = string.lchop("prefix")) != string`
<FromGitter> <j8r> For `String#[Range]`, like `String#[Index]`, it raises when the string is too short
<FromGitter> <j8r> The `?` variants do the check for us
<FromGitter> <j8r> With nillable, I simply do `if substring = string[3..9]?` and `if substring = string.rchop? '/'`
<FromGitter> <dscottboggs_gitlab> but would `"string"[3..9]?` return nil or `"ing"`?
<FromGitter> <dscottboggs_gitlab> that was my issue
<FromGitter> <girng> what does 9 do
<FromGitter> <dscottboggs_gitlab> `3..9` is a range from 3 to 9, including 3 but not 9
<FromGitter> <dscottboggs_gitlab> `3...9` is a range from 3 to 9, including 3 and 9
<FromGitter> <girng> but there is only 6 characters, or doesn't matter?
<FromGitter> <girng> it just goes to the end?
<FromGitter> <girng> last character
<FromGitter> <dscottboggs_gitlab> that's my point, after index 5 there's no value, so should indexing that value return nil, the partial selection, or raise an exception?
<FromGitter> <girng> oh lol
<FromGitter> <dscottboggs_gitlab> the current behavior is for "string"[3..9] to return "ing", @j8r is saying that should raise, and that the `[]?` version should do that
<FromGitter> <j8r> [] can raise yes
<FromGitter> <girng> well. i personally would like it return "ing" instead. if the number is higher, just go the end of the string
<FromGitter> <j8r> But []? can return nil or string
<FromGitter> <girng> that's just my opinion but im not a dev hahaah
<FromGitter> <j8r> `string` was an example variable, not a String itself
<FromGitter> <dscottboggs_gitlab> oooh! how about if there was `[]` which acts as it does now, `[]?` which returns nil on failure, or `[]!` to raise an exception
<FromGitter> <dscottboggs_gitlab> but we don't have a `[]!` operator so :/
<FromGitter> <girng> wow accidentally deleted my comment, dumb gitter UI
<FromGitter> <j8r> @dscottboggs_gitlab `[]` already raise...
<FromGitter> <dscottboggs_gitlab> I was just using the string literal "string" as an example
<FromGitter> <dscottboggs_gitlab> not for the range version if it's partially in range
<FromGitter> <dscottboggs_gitlab> were you just saying in the case where none of the range is in the string then?
<FromGitter> <j8r> `"a"[0..9]` produces index out of bounds, IIRC
<FromGitter> <j8r> And `"a"[9..99]` too
<FromGitter> <j8r> So instead having this exception, like `"a"[9]`, returns nil
<FromGitter> <j8r> The same idea as `"a"[9]?`
<FromGitter> <dscottboggs_gitlab> no, "a"[0..9] returns "a'
<FromGitter> <dscottboggs_gitlab> you're right thought that "a"[9..99] raises
<FromGitter> <j8r> Oh, so take the second one
<FromGitter> <dscottboggs_gitlab> and I see what you mean about that being an issue
<FromGitter> <j8r> Yeah you're right for the the 0..
<FromGitter> <j8r> I'll send a PR for rchop? and lchop? because it's really simple to implement – deleting the `else self end` to return nil
DTZUZO_ has joined #crystal-lang
<FromGitter> <vivus-ignis> hi! anyone with experience debugging crystal apps? how can i get to the object's fields in gdb?
<FromGitter> <vivus-ignis> this is what i have so far: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c45923720b78635b65a489e]
<FromGitter> <vivus-ignis> appreciate any hints, thank you!
<FromGitter> <dscottboggs_gitlab> I've tried, and not really had luck using debuggers with crystal. You can single-step and see what line you're on but that's about it
<FromGitter> <dscottboggs_gitlab> idk maybe someone else has some tricks I haven't heard of yet, I haven't used gdb/lldb a lot
<FromGitter> <vivus-ignis> got it, thanks for sharing
<FromGitter> <vivus-ignis> @dscottboggs_gitlab
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
ashirase has quit [Ping timeout: 240 seconds]
laaron has joined #crystal-lang
ashirase has joined #crystal-lang
<FromGitter> <j8r> @dscottboggs_gitlab I submitted https://github.com/crystal-lang/crystal/pull/7328
<FromGitter> <dscottboggs_gitlab> very nice
<FromGitter> <j8r> I noticed a typo in the specs :)
<FromGitter> <j8r> `lchomp` instead of `lchop`
<FromGitter> <dscottboggs_gitlab> nice catch!
<FromGitter> <j8r> @dscottboggs_gitlab on what projects are you working currently?
<FromGitter> <drum445> https://github.com/the-benchmarker/web-frameworks ⏎ Is this saying crystal frameworks are slower than ruby on average response time?
<FromGitter> <dscottboggs_gitlab> mainly this https://github.com/dscottboggs/flix.cr
<FromGitter> <dscottboggs_gitlab> @drum445 it does look like it says that. I wonder how roda gets such good response time
<FromGitter> <j8r> @drum445 onyx is much faster than kemal :o
<FromGitter> <j8r> someone knows why? Both use Radix
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 should run that benchmark on Athena, it doesn't use Radix
<FromGitter> <AllanKlaus> Anyone can understand why go frameworks are slower than roda (ruby)? (on average
<FromGitter> <girng> is it possible to use UInt8 with mysql's as {Int8} option?
<FromGitter> <dscottboggs_gitlab> wouldn't that be an Int8?
<FromGitter> <dscottboggs_gitlab> not a UInt8?
<FromGitter> <AllanKlaus> Hey guys, I was wondering to use crystal in production, but someone told me that "If your team can accept break changes and keen in binding C libraries in Crystal, that would be nice." ⏎ ⏎ Do you know what libraries is not working, because use C its not an option in my team?
<FromGitter> <girng> as : {Uint8} my bad lol yeah
<FromGitter> <girng> i tried {UInt8}, but i get ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c45a7ab35350772cf666e8c]
<FromGitter> <girng> and my mysql column type is tinyint *unsigned*!
<FromGitter> <dscottboggs_gitlab> Oh I see
<FromGitter> <dscottboggs_gitlab> did you try casting the block body with `as`?
<FromGitter> <girng> @AllanKlaus what u gonna use it for? web server? kemal runs in production on a hotel site, and some others :O
<FromGitter> <girng> hmm one sec
<FromGitter> <AllanKlaus> Its an API that receive request, access the database and return the values
<FromGitter> <dscottboggs_gitlab> like ⏎ ⏎ ```query_all query, *args do |result| ⏎ ... ⏎ end.as BlockReturnType``` [https://gitter.im/crystal-lang/crystal?at=5c45a843dab15872cecb4458]
<FromGitter> <dscottboggs_gitlab> @AllanKlaus crystal is relatively stable for that sort of workload. I've patched libraries based on several versions of crystal ago easily.
<FromGitter> <girng> ```MySql::ResultSet#read returned a Int8. A UInt8 was expected.``` ⏎ ⏎ LOL WAT??? [https://gitter.im/crystal-lang/crystal?at=5c45a899ba355012a4730498]
<FromGitter> <girng> It's a tinyint unsigned in mysql, isn't that a UInt8?
<FromGitter> <dscottboggs_gitlab> There are still breaking changes you have to account for occasionally and will be for the foreseeable future, but there are still plenty of people using it in production
* FromGitter * dscottboggs_gitlab shrugs @girng
<FromGitter> <AllanKlaus> @dscottboggs_gitlab thx guy. I will discuss with my team to adopt Crystal
<FromGitter> <girng> 🔮
<FromGitter> <dscottboggs_gitlab> I hope it goes well for you!
<FromGitter> <girng> @AllanKlaus good luck!!
<FromGitter> <dscottboggs_gitlab> @girng perhaps it's an issue with the MySql Adapter shard
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c45a9727a0f4d5b19e32be9]
<FromGitter> <girng> If I choose Int8, it works fine. Then my 255 value get's converted to 125 😆 😆
<FromGitter> <dscottboggs_gitlab> Please report that to the shard and post a link, I'll take a look at fixing it t omorrow
<FromGitter> <girng> okie dokie
<FromGitter> <j8r> @vlazar because of reuse port it is more performant you think?
<FromGitter> <girng> @dscottboggs_gitlab got it https://github.com/crystal-lang/crystal-mysql/issues/70
<FromGitter> <dscottboggs_gitlab> thanks
<FromGitter> <vlazar> > @vlazar because of reuse port it is more performant you think? ⏎ @j8r yes, other implementations (except for onyx and spider gazelle) are using single process unless I miss something
<FromGitter> <dscottboggs_gitlab> ☝️ January 21, 2019 6:31 AM (https://gitter.im/crystal-lang/crystal?at=5c45ad7f35350772cf669862) ah, it looks like they don't have any support for *unsigned* modifiers yet.
<FromGitter> <dscottboggs_gitlab> @vlazar that could explain why Crystal wasn't higher in the ratings as well. I know Kemal has the option to `fork` like onyx does by default, but it's not on by default.
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <drum445> Seems strange that Crystal is slower though
<FromGitter> <drum445> Especially as web apis will be a pretty large use-case for it
<FromGitter> <dscottboggs_gitlab> not if the benchmark emphasised multi-core responses and the default settings were used.
<FromGitter> <dscottboggs_gitlab> Crystal is primarily single-threaded at this stage
<FromGitter> <j8r> @dscottboggs_gitlab we could make a PR then :)
<FromGitter> <dscottboggs_gitlab> to be fair a multi-threaded web server should probably do more than `cpu_cores.times { fork { serve_up } }`
<FromGitter> <dscottboggs_gitlab> like maybe a bit of error checking
<FromGitter> <j8r> totally agree, it's counter productive to fork more than the max number of cpus
<FromGitter> <dscottboggs_gitlab> I'm off to bed, ✌️
<FromGitter> <mavu> I am trying to use libwiringPI with crystal, and it requires me to pass a callback to C-land. I made a proc that only consists of puts "something". ⏎ That works fine, and It gets called / executed as it is supposed to. ⏎ but how can I actually "interface" this callback with the rest of my program? ⏎ As soon as I try to use outside variables or methods I get "Unhandled exception: passing a closure to C is
<FromGitter> <mavu> I did find this "Passing a closure to a C function" chapter in the documentation, but its about passing data, and I basically want to use outside functions?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Client Quit]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Client Quit]
<FromGitter> <Blacksmoke16> @dscottboggs_gitlab not a bad idea
laaron has joined #crystal-lang
laaron has quit [Client Quit]
laaron has joined #crystal-lang
<oprypin> mavu: not sure why you say it's about data. seems like it's exactly what you're asking, maybe it's just unclear?
<FromGitter> <mavu> @oprypin Ok apparently unclear then :) ⏎ I'll read it again and try it. Its already a help knowing it should work.
<FromGitter> <Blacksmoke16> hm, having trouble running that locally
<FromGitter> <mavu> Ok, I don't get it. ⏎ this is the function that wants the callback. the callback has not return and takes no arguments. ⏎ fun wiringPiISR(pin : LibC::Int, edge_type : LibC::Int, f : Void -> Void) : LibC::Int
<FromGitter> <mavu> I don't see how I can give a proc to that function which takes an argument.
<FromGitter> <mavu> as it seems to me is done in the "Passing a closure" chapter. ⏎ Does anyone have a link to this being done in a example? or actual code?
<oprypin> mavu: github.com/oprypin/crystal-chipmunk
<oprypin> the function must accept an arbitrary userdata pointer and then pass it back to the callback
<oprypin> if it doesn't then indeed you can't do anything about it, at least without having some kind of global state
<FromGitter> <mavu> Ahhh...
<jokke> how can i display stack traces in production builds?
<jokke> --debug ?
<oprypin> i think so
<FromGitter> <mavu> Ok, so if the C function that I want to use has this signature: ⏎ int wiringPiISR (int pin, int mode, void (*function)(void)) ; ⏎ which means the callback it takes has no return value and takes no arguments, then I can't do this?
<jokke> cool thx
<oprypin> mavu: can't do this. seems like a bad lib ;)
<FromGitter> <mavu> ok, is there any other way to "break out" of the callback? I mean, I can put "puts something" in there and see the result.
<oprypin> just don't access any local variables....
<FromGitter> <mavu> as in instance variables will work?
<FromGitter> <mavu> I thought I tried that..
<oprypin> probably not. I'm fuzzy on the details
<oprypin> well the thing is instance variables depends on the notion of "current object" which is exactly like a local variables
<FromGitter> <mavu> hmm, i'm not beyond opening a socket and writing to that if it comes to that.
<FromGitter> <Blacksmoke16> yea that benchmark thing doesnt work for me :/
<FromGitter> <Blacksmoke16> ```Benchmark running ... ⏎ --: 1: --: Syntax error: word unexpected (expecting ")")``` [https://gitter.im/crystal-lang/crystal?at=5c45e246dab15872ceccc12a]
<oprypin> @mavu: just use a global variable. which in Crystal means creating a module with a class variable
<jokke> hmmm
<oprypin> or uh just directly use a class variable
<jokke> Invalid memory access (signal 11) at address 0x1c
<jokke> when i try building with --release and --debug
<jokke> (and --static)
<oprypin> static is broken, why u using it
<oprypin> always been broken
<jokke> since when?
<jokke> not on alpine?
<jokke> works fine
<oprypin> well it happens to work in some cases on Alpine, whatever
<jokke> i don't want to have a huge docker image :/
<FromGitter> <mavu> @oprypin Just tried that, and it seems to work Thanks!
<FromGitter> <j8r> jokke: you can use multistage build
<jokke> yeah
<jokke> that's what i'm currently doing with static
<jokke> i can use scratch for the final image
<jokke> which is awesome
<FromGitter> <j8r> --debug will undoubtly return a larger binary
<FromGitter> <j8r> Some Go binaries weights ~50MB because of this
<jokke> wow
<jokke> dang
<jokke> but it's necessary for stack traces right?
<FromGitter> <j8r> I guess that's the added symbols
<FromGitter> <j8r> used in stack traces
<FromGitter> <edwardloveall> Hi all, I'm trying to hunt down my problem and I'm wondering if this error message means anything or is just a red herring
<FromGitter> <edwardloveall> the difference i'm seeing is `no overload matches X with type Y` vs `no overload matches X, Y`
<FromGitter> <edwardloveall> anyone know what the difference is?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> It's expecting the argument to go to be of type thing
<FromGitter> <Blacksmoke16> Due to your generic
<FromGitter> <nagash> @edwardloveall Yeah ^ https://play.crystal-lang.org/#/r/622w
<FromGitter> <Blacksmoke16> @edwardloveall
<FromGitter> <edwardloveall> ah right, yes. I get the error part, I was just seeing a similar but different error in the `migration.cr` file there
<FromGitter> <edwardloveall> the User::BaseForm is expecting a User and String (record and username) which is what I think i'm giving it, but it's not matching for whatever reason
<FromGitter> <edwardloveall> i was trying to figure out *why* I was getting that error
<FromGitter> <edwardloveall> so I tried to recreate it
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <edwardloveall> here's the codebase where I just pushed up my WIP branch: https://github.com/edwardloveall/lucky_bits/commit/b0a42e0faec2d18b0b5a509c8c59111f7cd09a66
<FromGitter> <edwardloveall> if anyone wants to dig in futher
<FromGitter> <edwardloveall> once Lucky is setup with `bin/setup`, I was running `lucky db.migrate`
<FromGitter> <Blacksmoke16> yea sadly i never used lucky :/
<FromGitter> <Blacksmoke16> but i feel like that should work since types are correct and everything else has default values
<FromGitter> <edwardloveall> no worries, thanks for letting me know I'm not crazy :D
<FromGitter> <edwardloveall> I think I figured it out
<FromGitter> <edwardloveall> `UserQuery` and `User::BaseForm` are defined when you create a `User` model. the User model in the migration was shadowing another User model previously defined. So i changed the class name to `TempUser` and moved all the other classes to match and it works :slight_smile:
<FromGitter> <Blacksmoke16> that would do it
<FromGitter> <nagash> @edwardloveall Ah. I think UserQuery is the problem, as it's global? While the others appear to be locally scoped/generated within the migration. Changing UserQuery to User::BaseQuery may have also worked.
<FromGitter> <edwardloveall> I beleive that the problem is that UserQuery is giving me a User (of one kind) but I needed a User of a local kind
<FromGitter> <nagash> Yeah. User::BaseQuery is also generated, so should also be locally scoped if used directly.
<FromGitter> <nagash> And return the locally scoped Users.
<FromGitter> <edwardloveall> yeah here's what I ended up with: https://gist.github.com/edwardloveall/11d56af9beeada461235c291223d6d9e
<FromGitter> <edwardloveall> I think this distils what I was seeing: https://play.crystal-lang.org/#/r/6234
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6235 fixed :)
<FromGitter> <edwardloveall> haha
<FromGitter> <edwardloveall> @nagash you were right, using `User::BaseQuery` worked also
<FromGitter> <silmanduin66> Hello
<FromGitter> <Blacksmoke16> o/
<FromGitter> <silmanduin66> i just saw rust can compile to wasm , do we have some plans to do the same with crystal ?
<FromGitter> <fridgerator> There have been discussions about it : https://github.com/crystal-lang/crystal/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+wasm
<FromGitter> <fridgerator> no plans afaik
<FromGitter> <fridgerator> a big issue being the GC
<FromGitter> <j8r> is it possible to split a String directly to a Set, with no intermediate Array?
<FromGitter> <j8r> Oh, I guess with `split &block` - nvm
<FromGitter> <j8r> https://carc.in/#/r/6236
<FromGitter> <j8r> Go can compile to wasm too
<FromGitter> <j8r> that's reassuring to know it's possible to compile a GC'd lang to wasm
<FromGitter> <Blacksmoke16> well
<FromGitter> <Blacksmoke16> got the expansion thing done
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c46050483189945242698fc]
<FromGitter> <Blacksmoke16> `GET /users/17 # => {"id":17,"age":123}`
<FromGitter> <Blacksmoke16> `GET /users/17?expand=customer # => {"id":17,"age":123,"customer":{"name":"MyCust","id":1}}`
<FromGitter> <Blacksmoke16> `GET /users/17?expand=customer,customer.setting # => {"id":17,"age":123,"customer":{"name":"MyCust","id":1,"setting":{"name":"Settings","id":2}}}`
<FromGitter> <Blacksmoke16> 💯
Raimondi has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
<FromGitter> <vladfaust> Too complex example
<FromGitter> <Blacksmoke16> How would you make it simpler?
<FromGitter> <Blacksmoke16> Is just the controller and three models
jemc has joined #crystal-lang
ton31337 has joined #crystal-lang
<ton31337> Hi guys
<ton31337> if splitted[i] == ":" && splitted[i+1] == ":"
<ton31337> how to check this boundary?
<ton31337> i+1?
<ton31337> because Index out of bound :)
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.27.0/String.html#%5B%5D%3F%28index%3AInt%29-instance-method
<FromGitter> <Blacksmoke16> but might be better depending on what you're trying to do
<ton31337> I just want to check i+1 element, but avoid out of bound errors
<FromGitter> <Blacksmoke16> add a `?` then
<FromGitter> <Blacksmoke16> will return nil if out of bounds
<ton31337> m, where?
<ton31337> ]?
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/623t
<FromGitter> <Blacksmoke16> yes
<ton31337> damn, cool
<ton31337> how I missed that
<ton31337> thanks
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.27.0/Char/Reader.html might be interested in that
<ton31337> thanks!
ton31337 has quit [Quit: leaving]
<FromGitter> <matthewmcgarvey> Hmm, I was just looking at the source for []? and it led me to the source of at (https://github.com/crystal-lang/crystal/blob/c9d1eef8fde5c7a03a029d64c8483ed7b4f2fe86/src/string.cr#L826). Having a `yield` in your method changes the method signature? Is that how it’s able to have two `at(index : Int)`’s ?
<FromGitter> <Blacksmoke16> thats the block version
<FromGitter> <Blacksmoke16> `at(index) { raise IndexError.new }`
<FromGitter> <matthewmcgarvey> Hmm, that’s tricky to see
<FromGitter> <Blacksmoke16> so like if its out of range will execute whats in the block
<FromGitter> <Blacksmoke16> in this case, raise the exception
<FromGitter> <Blacksmoke16> normally you'd see a `&block` in the api docs, not sure why these dont?
<FromGitter> <matthewmcgarvey> That was string source, the array method is `fetch` and it does have that parameter documented https://github.com/crystal-lang/crystal/blob/c9d1eef8fde5c7a03a029d64c8483ed7b4f2fe86/src/indexable.cr#L52
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <matthewmcgarvey> nvm :( wrong method but at least these methods have documentation
<FromGitter> <drum445> Recent update to the sublime plugin? Seems to print to console when I have a syntax error