jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<raz> Blacksmoke16: how do i set the response status code in athena?
<raz> (inside controller method)
<FromGitter> <Blacksmoke16> ofc you may need to wire up the latter thing if you're using a custom view implementation
<raz> hmm, i'd rather just continue returning my JSON::Serializable
<FromGitter> <Blacksmoke16> then use the annotation approach?
<raz> hum, how would i do that?
<raz> that's what i have so far
<FromGitter> <Blacksmoke16> i assume this is just an example?
<FromGitter> <Blacksmoke16> creating a user on a GET endpoint?
<raz> my framework doesn't support POST yet 😑
<FromGitter> <Blacksmoke16> rip
<raz> but i was promised just a few more days :p
<FromGitter> <Blacksmoke16> did you end up using a custom view listener? or are you using the build in one?
<FromGitter> <Blacksmoke16> built in*
<raz> slightly patched, but only to wrap it for json:api
<raz> (line 28, the rest is vanilla)
<raz> oh and the header
<FromGitter> <Blacksmoke16> sec, you can more easily simplify this
<raz> JenniferTwin (their serialization thing) is JSON::Serializable, so otherwise it just works
<FromGitter> <Blacksmoke16> like if your serialization logic is that trivial, have you considered just adding a helper method to the base controller type? then doing like `self.json UserTwin.new ...`?
<FromGitter> <Blacksmoke16> where that method is just like
<raz> well, not all my endpoints will return UserTwins
<raz> but they will all return something JSON::Serializable, so that view does what i need
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd033355a63c561051b5736]
<raz> hmmm
<raz> ok yea, guess i can do that.
<FromGitter> <Blacksmoke16> the view layer stuff is intended for more complex logic, bit overkill if all you want to do is wrap in a `data` key
<raz> well, i thought that way i can just return JSON::Serializable and not worry
<raz> but looks like i have to wrap a response anyway, to change the status code
<FromGitter> <Blacksmoke16> to be clear what you had in the listener would work
<FromGitter> <Blacksmoke16> as it sets that status based on `view.status`, which can be altered via the `@[ART::View]` annotation, like in the example i linked
<raz> ohhh, i missed that
<raz> @[ART::View(status: :created)]
<raz> yap, that did it for me, noice!
<FromGitter> <Blacksmoke16> https://carc.in/#/r/a33g
<FromGitter> <Blacksmoke16> could make your thing a bit simpler
<FromGitter> <Blacksmoke16> i.e. fallback on the default if its not something it can handle
<raz> hmm yea, will look into that. but i don't really like fallbacks to invisible code, so will probably keep the verbose version
<FromGitter> <Blacksmoke16> okey dokey
<raz> but it's all very pleasant so far πŸ‘ - if i can get POST then my api is almost done :D
<FromGitter> <Blacksmoke16> whats holding back POST endpoint? the front end or?
<raz> RequestParam is not in 0.11
<FromGitter> <Blacksmoke16> ah right
<FromGitter> <Blacksmoke16> dont just want to pin to the commit for now?
<raz> maybe later, i'll just do my endpoints with GET for now ;)
<FromGitter> <Blacksmoke16> as you wish
<FromGitter> <Blacksmoke16> oh yea your thing is going to break in `0.12.0` :0
<FromGitter> <Blacksmoke16> `action.view` is now `action.view_context` btw
<raz> yup that's fine, i expect some breakage, it's 0.11 after all ;)
<raz> and it's only ~100 LOC (w/o the endpoints) so i'll just patch up
<FromGitter> <Blacksmoke16> easy enough
<raz> yup, reminds me a lot of spring from java-land, but with so much less boilerplate that it's actually good
<FromGitter> <Blacksmoke16> ❀️
<FromGitter> <watzon> @Blacksmoke16 what would be the most efficient way to find and delete multiple records with Granite? Basically I want to delete every model that has a field that matches a query.
<FromGitter> <watzon> But there might be a lot so I'd like to avoid deleting them one by one
<FromGitter> <Blacksmoke16> mm probably some raw sql
<FromGitter> <Blacksmoke16> with a `.exec`
<FromGitter> <watzon> Damn I was hoping there might be a built in way
<FromGitter> <Blacksmoke16> was an issue about it, i dont remember if it was ever implemented or not tho
Vexatos has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 272 seconds]
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
<FromGitter> <watzon> Well that was an easy bug to find
<FromGitter> <watzon> https://carc.in/#/r/a33r
trepanger has left #crystal-lang [#crystal-lang]
r0bby has quit [Ping timeout: 260 seconds]
renich has quit [Ping timeout: 260 seconds]
r0bby has joined #crystal-lang
<FromGitter> <watzon> I think I'm finally going to break down and try writing my own "active record" style ORM. I need something that is feature complete and has built in migration support.
renich has joined #crystal-lang
renich has quit [Quit: Leaving.]
<Andriamanitra> pretty braindead way to solve day 9 but i like how concise i managed to make it https://github.com/Andriamanitra/adventofcode2020/blob/main/day09/solution.cr
f1refly has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
<kevinsjoberg> Andriamanitra: Mine also abysmal from a performance perspective, but it works.
<kevinsjoberg> Not at all happy with part 2, but whatever.
<f1refly> Wow, didn't know you could tell each_cons to reuse the memory, very nice
hightower4 has quit [Remote host closed the connection]
Vexatos has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
<kevinsjoberg> Anyone with merge access to the Crystal TextMate bundle? If so, I'd love to get this in. https://github.com/crystal-lang-tools/Crystal.tmbundle/pull/21
<jhass> apparently I do for some reason :D
<jhass> just gonna trust you on this, seems simple enough
<kevinsjoberg> jhass: Sweet. There's one more incoming soon, a bit more complex.
<jhass> not watching any of this, so ping me again then ;P
<kevinsjoberg> It fixes the indentation rules that were taken from Ruby to correctly indent methods with a visibility modifier before it as well as classes marked as either private or abstract.
* FromGitter * erdnaxeli:cervoi.se New day, new AoC, new questions :p
* FromGitter * erdnaxeli:cervoi.se this fail to compile: https://carc.in/#/r/a343 ?
* FromGitter * erdnaxeli:cervoi.se my computer it eats all my memory, then crashes
* FromGitter * erdnaxeli:cervoi.se will open a bug
<jhass> kevinsjoberg: you must be like one of the two people left still using textmate :D
<kevinsjoberg> jhass: haha, old habits die hard. :P
hightower4 has joined #crystal-lang
<hightower4> Hm, straight-shoota you mentioned the other day that %Q() wasn't valid, that the syntax was %q() or %(). But looking at https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html , somewhere in the middle of the page it does mention %Q as being identical to %
* FromGitter * erdnaxeli:cervoi.se <@erdnaxeli:cervoi.se> I will open a bug ⏎ ⏎ https://github.com/crystal-lang/crystal/issues/10062
<FromGitter> <naqvis> https://carc.in/#/r/a34c ⏎ seems problem happens when you assign that to ivar
<FromGitter> <naqvis> hightower4 yeah and the snippet provided also works ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd09c523646a85814daa04a]
<raz> watzon: clear orm or jennifer both do it (`Foo.where { bar = batz }.delete` generates a `delete from .. where ...` statement)
<FromGitter> <cuteghost> Hi everyone, I need help regarding `HTTP::Server`. Thing is that I need to redirect a request to a new location. I have something like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd0a7d967034a3e90f93943]
<FromGitter> <cuteghost> and when I do request to the `` I get 200 as status code but no body with `YAY`
<FromGitter> <cuteghost> Am I missing something that I need to implement
<FromGitter> <Dan-Do> Try debugging using developer console in web browser, tab "network"
<FromGitter> <Dan-Do> maybe the "Location" header should be full url, not sure :)
<hightower4> cuteghost at a minimum you're missing the response with "content-type: text/html" etc.
<hightower4> and you test whether your path is "/signup" twice
<hightower4> (both in if and elsif)
<FromGitter> <cuteghost> oh my bad
<FromGitter> <cuteghost> in elsif location is different
<FromGitter> <cuteghost> and it still doesn't work
<FromGitter> <cuteghost> this is just a recap of my code it's a lot bigger
<hightower4> it works for me
<FromGitter> <cuteghost> try making request with HTTP::Client.exec
<hightower4> curl 0:18000/signup -> redirecting, curl 0:18000/login -> YAY
<hightower4> so the remaining issue is why it's not redirecting
<FromGitter> <cuteghost> yeah I cant get body with HTTP::Client
<hightower4> you are setting the status with == instead of =
<hightower4> looks like you're trolling
<FromGitter> <cuteghost> oh damn
<FromGitter> <cuteghost> missed
<FromGitter> <cuteghost> but it doesnt work with single = sign
<FromGitter> <cuteghost> thank you a lot
<FromGitter> <Daniel-Worrall> How come StaticArrays can't be instantiated with a size at runtime?
<yxhuvud> uh, the whole point of StaticArray is that they should be possible to allocate as a known size on the stack or *embedded* in other objects.
postmodern has quit [Quit: Leaving]
<FromGitter> <Daniel-Worrall> right
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
Nekka has quit [Ping timeout: 260 seconds]
Nekka has joined #crystal-lang
<straight-shoota> hightower4, IIRC it was Q() that I mentioned would not work
<straight-shoota> the percent sign could ambigously be attached to Q or the preceding {
<raz> wait, is Q reserved?
* raz suspiciously looks at his `class Q`
<yxhuvud> no.
<raz> good 😌
<FromGitter> <asterite> Andriamanitra: nice!
<straight-shoota> raz, Q() is a call and a method can't start with an upper case character
<straight-shoota> you can't call a type/constant
<raz> ah right, makes sense
<hightower4> straight-shoota, ah yes, yes, ok great
<raz> i'm in fact glad that crystal actively prohibits that, instead of coming up with absurd ideas like, i don't know, making public methods uppercase or such (that would be terrible)
<FromGitter> <Blacksmoke16> @raz
<raz> hooray! πŸ™‡β€β™‚οΈ
* FromGitter * erdnaxeli:cervoi.se you were right, my problem was related to using an ivar. But i don't get why the behavior change with an ivar or a "normal" var. ⏎ ⏎ Btw you can call `a` while still using `@a` in the function signature, I didn't know: https://carc.in/#/r/a35n
* FromGitter * erdnaxeli:cervoi.se that's not the first time I noticed you can use `@a` and `a` to access the same variable, but I must admit I don't get the logic here
<straight-shoota> when you have an ivar as a method argument like `def foo(@a); end`, that's essentially expanded to something like `def foo(a); @a = a; end`
<straight-shoota> so the ivar is not *generally* available as a local variable, but the argument to a method is
<raz> blacksmoke16: i always thought 16 is your age, but looking at your output i'm now more inclined to think it must be the athena team-size. you should credit those other 15 sometime :p
<straight-shoota> if you change @a in the method body, a will still refer to the argument
<FromGitter> <Blacksmoke16> ha, naw just my fav number :p
<raz> :D
<straight-shoota> the idea is that when the ivar is nilable but the argument is not, you can be sure that you have a non-nilable value in the local variable
* FromGitter * erdnaxeli:cervoi.se right, but then how this record works: https://carc.in/#/r/a35t?
<raz> solid work really. i mean good code is one thing, but you also kill it on the docs front and even community building / announcements along with it πŸ™‡β€β™‚οΈ
<FromGitter> <Blacksmoke16> i try 😊
<straight-shoota> the record macro defines getters for all ivars
* FromGitter * erdnaxeli:cervoi.se right. Thanks!
<raz> blacksmoke16: ah, it looks not yet incomplete tho! https://github.com/athena-framework/athena/blob/acbbd661b92e6738f0699c3e4d75c0991300ddf2/src/ext/request.cr (this works for `x-www-form-urlencoded` which is what most clients use by default. but there's also content-type `multipart/form-data`, that one needs to be parsed w/ https://crystal-lang.org/api/0.32.1/HTTP/FormData.html)
<FromGitter> <Blacksmoke16> πŸ™ˆ
<raz> and of course `application/json`, but that's a whole can of worms of its own (should prob be left to the user, parsing it to JSON::Any is prob not very useful in most cases)
<FromGitter> <Blacksmoke16> id prob be more likely to specify the limitation of it
<FromGitter> <Blacksmoke16> or looking at the docs prob would be doable to support both form datas
<raz> yea, the current version is fine for me πŸ‘ - just wanted to give a heads up. `multipart/form-data` is normally only relevant for file uploads, but in practice i've also seen clients just use it for everything
<raz> yup, you could in principle just parse both FormData and Params to a Hash(String, String). (i think String is binary safe when it's a file, right?) the only concern that follows then is "but what about that 8GB file upload". not sure how the other crystal frameworks handle it atm
<FromGitter> <Blacksmoke16> i added a card to the backlog
<raz> πŸ‘Œ(fyi, curl gives multipart/form-data with `curl -F`, handy for testing)
<FromGitter> <Blacksmoke16> πŸ‘
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
jrayhawk has quit [Quit: Lost terminal]
jrayhawk has joined #crystal-lang
ua_ has quit [Ping timeout: 258 seconds]
ua has joined #crystal-lang
<FromGitter> <Daniel-Worrall> https://github.com/Daniel-Worrall/advent-of-code-2020/blob/main/src/crystal/9.cr I thought my solution was pretty good until I read other peoples
<FromGitter> <Daniel-Worrall> Also, I got lazy and didn't do optimisations on p2
<FromGitter> <Daniel-Worrall> If you just have 2 pointers and go down the list, add and subtract as you go
<yxhuvud> I used a deque. The problem is that deques don't have each_combination..
<raz> hm, each_combination as in each pair popped from both ends of the que?
<raz> or all permutations of all queue items
renich has joined #crystal-lang
<FromGitter> <RespiteSage> @raz https://crystal-lang.org/api/0.35.1/Array.html#each_combination(size:Int=self.size,reuse=false,&):Nil-instance-method
<FromGitter> <RespiteSage> It's apparently undocumented, but I think it's the same as `each_permutation` except that it's combinations (no reordering of the same elements).
<kevinsjoberg> I was fairly happy with part 1.
<FromGitter> <RespiteSage> I started with https://github.com/RespiteSage/aoc2020/blob/67f8c089f57eebad549caefec0653acc6c8828a7/9.cr and then cleaned it up to https://github.com/RespiteSage/aoc2020/blob/main/9.cr after seeing @Daniel-Worrall use `#take_while`.
<FromGitter> <Daniel-Worrall> Yeah, the idea to start from the end didn't occur to me. It was a good trick from last year's aoc too so I should have remembered
<FromGitter> <RespiteSage> Yeah, I didn't think to do that, either.
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 272 seconds]
<yxhuvud> @kevinsjoberg: my day9 is not as terse as yours, but roughly a magnitude faster :) https://github.com/yxhuvud/aoc20/blob/master/day9.cr
<kevinsjoberg> yxhuvud: yeah, my performance characteristics are shit πŸ˜…
<kevinsjoberg> yxhuvud: really like the use of Deque by the way. Nicely done!
renich has quit [Ping timeout: 264 seconds]
<yxhuvud> Hmm. Just realized I can cut 4 lines if I skip handling lines that are 0 in the preamble.
<FromGitter> <anthonyshull> is there a way to set a property setter to be protected but getter to be public?
<FromGitter> <Blacksmoke16> ```getter name : String ⏎ protected setter name : String``` [https://gitter.im/crystal-lang/crystal?at=5fd105a428a57c581b0230b5]
<FromGitter> <anthonyshull> awesome, thanks. so the macro just creates overloaded methods?
<FromGitter> <Blacksmoke16> the macro just defines the ivar/methods
<FromGitter> <anthonyshull> and do the types both have to agree? like if i have a getter : String? but a setter : String
<FromGitter> <Blacksmoke16> would be fine yea, wouldnt be able to do `obj.name = nil` in that case, even if the getter could return `nil`
<FromGitter> <anthonyshull> yeah, that's what i'm after. basically so that my library can set values but the consumer can't
<FromGitter> <anthonyshull> appreciate the expressiveness...
<FromGitter> <Blacksmoke16> any reason they cant just be set on creation? i.e. `MyObj.new name: "fred"`
<FromGitter> <anthonyshull> just that there are a lot of values
<FromGitter> <anthonyshull> i mean, i guess the fact they are named arguments
<FromGitter> <anthonyshull> makes it less cumbersome
<FromGitter> <Blacksmoke16> yes, because if the values are immutable dont really need to expose a setter at all
<FromGitter> <anthonyshull> nice, yeah, that makes sense
renich has joined #crystal-lang
<FromGitter> <vladfaust> Does anyone has code to run `it` in parallel? E.g. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd1112955c9c37b30564c6c]
<FromGitter> <Blacksmoke16> not a thing atm
<FromGitter> <Blacksmoke16> built in at leats
<FromGitter> <vladfaust> Indeed. May be someone came to extending `Spec` w/ channels
mistergibson has quit [Quit: Leaving]
<FromGitter> <watzon> Vlad my friend!
<frojnd> I'm using this shard: myhtml... I have problem with getting response.... When I try to access url with browser I get immediate response, but with HTTP::Client.get url sometimes I don't get response... can I see some more verbose messages to see what's going on?
<frojnd> Wow after 4 minutes
<frojnd> Anyways why is it taking it so long?
<FromGitter> <Blacksmoke16> got some code to share?
<frojnd> Not much to share: https://carc.in/#/r/a39c
<FromGitter> <Blacksmoke16> have fast internet?
<frojnd> As I said with browser in miliseconds...
<FromGitter> <Blacksmoke16> id imagine the browser caches the content so it doesnt actually make a request
<frojnd> But to answer your question... 150/50 Mbit/ dl/ul
<frojnd> Hm I dunno
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd1327bc829e14ef284bec1]
<FromGitter> <Blacksmoke16> half a sec for me
postmodern has joined #crystal-lang
<frojnd> I did it again in incongnito mode and looked in network tab: 1,3 seconds
<FromGitter> <Blacksmoke16> sure nothing else is going on?
<frojnd> I don't know to be honest.. I still have ram left :p Cpu also...
<straight-shoota> maybe try strace
<FromGitter> <Blacksmoke16> i mean is the code exactly the same as the example?
<frojnd> Yes
<FromGitter> <Blacksmoke16> and running that locally in a file of its own it takes forever also? or only when used with `myhtml` lib installed
<frojnd> Let me try both cases
<frojnd> With just http/client in file running crystal run src/parser.cr takes forever
<frojnd> I'll try also add myhtml since I intend to use it extensivelly
<FromGitter> <Blacksmoke16> and the only content of `src/parser.cr` is like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd1347a03da931ac240f335]
<frojnd> Ups, I forgot to add `puts "Response #{response}"` <- with this is the exactly the same
<FromGitter> <Blacksmoke16> hm yea i dunno, that didnt change anything for me
<FromGitter> <Blacksmoke16> what happens if you just curl it?
DTZUZU_ has joined #crystal-lang
f1reflyylmao has quit [Quit: bye fags]
<frojnd> Lol immediate content
f1reflyylmao has joined #crystal-lang
DTZUZU has quit [Ping timeout: 260 seconds]
f1refly has quit [Disconnected by services]
f1reflyylmao is now known as f1refly
<frojnd> Is it possible sites throttle traffic depending on the client hitting the server?
<FromGitter> <Blacksmoke16> given i did the same code and it was fine prob not
<FromGitter> <Blacksmoke16> but :shrug:
<frojnd> Well anyways will try tomorrow
* FromGitter * erdnaxeli:cervoi.se to be sure:Β an HTTP::Client object cannot be used on two different fiber, right?
<FromGitter> <Blacksmoke16> it *can* but might run into errors
DTZUZU has joined #crystal-lang
<straight-shoota> so basically, no
* FromGitter * erdnaxeli:cervoi.se ^^
<straight-shoota> HTTP::Client can't be used concurrently
<frojnd> Can you try also this one? https://carc.in/#/r/a39e found another url that is not responding for me
<frojnd> How can I run with strace straight-shoota?
<frojnd> One more thing before I call it a night
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd1384191e8cb3e8cef8a6e]
<straight-shoota> strace crystal file.cr
DTZUZU_ has quit [Ping timeout: 256 seconds]
<frojnd> Well this is odd for me
<frojnd> Oh so system strace binary
<straight-shoota> yeah
<frojnd> I get epoll_wait(13,
<frojnd> epoll_wait(13, [], 32, 5000) = 0
<frojnd> This line keeps repating every few seconds
<FromGitter> <watzon> Any idea what the problem is here? https://carc.in/#/r/a39k
<frojnd> Later this is too much for me hehe at the moment
<FromGitter> <watzon> Methods don't appear to be annotated even though they are, ans `cls.instance_vars` comes up as empty as well.
<FromGitter> <watzon> I thought the `finished` macro would wait for that all to be defined
<FromGitter> <Blacksmoke16> instance vars is only a thing within context of a method
<FromGitter> <watzon> Ahh ok, well how about annotated methods?
<FromGitter> <Blacksmoke16> those should be fine
<FromGitter> <Blacksmoke16> but you dont have any methods with that annotation
<FromGitter> <watzon> Ok so it isn't counting the methods created by the `property` keyword as being an annotated method. Man I just want to annotate properties haha, it shouldn't be this complicated.
<FromGitter> <Blacksmoke16> thats what the annotation is being applied to
<FromGitter> <Blacksmoke16> the ivar created by `property`
<FromGitter> <watzon> Right. I guess I might need to create an initializer for the abstract class then, and then make the generated initializer call super. Think that will work?
<FromGitter> <Blacksmoke16> what are you trying to do exactly?
<FromGitter> <watzon> For now just experimenting and seeing if the way I want to lay out models will even work
<FromGitter> <Blacksmoke16> have you considered *not* generating an initializer and just let it be like any other crystal type?
<FromGitter> <anthonyshull> anyone know of any good resources on using crystal for language programming? lexing, parsing, etc.?
<FromGitter> <anthonyshull> we are looking at building a tool similar to https://github.com/zyedidia/Literate but with support for multiple languages
<FromGitter> <Blacksmoke16> if you follow what the compiler does, just a 1k long if/elseif statement
<straight-shoota> there are actually lots of compilers/interpreters written in Crystal you can take a look at how they deal with these things
<FromGitter> <anthonyshull> i was looking at something like mint which is pretty impressive
<straight-shoota> indeed
<FromGitter> <anthonyshull> nice
<FromGitter> <watzon> @Blacksmoke16 that's half the goal. I want to make the generated initializer optional, which is what the `Table` macro is for. People will just have to remember to call `super` in their own initializer I guess.
<FromGitter> <Blacksmoke16> thats going to be a nightmare
<FromGitter> <Blacksmoke16> i can speak from experience with granite
<FromGitter> <Blacksmoke16> i guess what stuff needs set in the parent initializer anyway?
<FromGitter> <Souravgoswami> Just a simple question I have got for months now... How do I optimize the binary? Like passing -O3, -mtune=native, -march=native clang like flags?
<FromGitter> <Blacksmoke16> `--release`
<FromGitter> <Blacksmoke16> `crystal build --release app.cr`
<FromGitter> <Souravgoswami> Well got it... But I don't think I am talking about this. In GCC/Clang/Icc, you can pass the -O3 option to optimize a binary... Does crystal have such implementation?
<FromGitter> <Blacksmoke16> no, its the `--release` flag
<FromGitter> <Blacksmoke16> that tells LLVM to produce an optimized binary
<FromGitter> <Souravgoswami> Ah it's quite nice to have just one flag... Thanks a lot!
<FromGitter> <Souravgoswami> Yeah gotcha
<FromGitter> <Blacksmoke16> πŸ‘
<FromGitter> <Souravgoswami> Although if I use static: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fd13f231f36292125dfc221]
<FromGitter> <Souravgoswami> But I do have pcre installed on my system, using Arch Linux x86_64
<straight-shoota> do you have the static library?
<straight-shoota> it's probably not going to work anyways, static linking doesn't play nice with glibc
<straight-shoota> you need to link against musl
<FromGitter> <Souravgoswami> I have the library... Btw thanks for the info!
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 246 seconds]
<FromGitter> <watzon> @Blacksmoke16 the main thing the parent initializer is going to do is handle the annotations. Granted this is all discovery right now, chances are I'll find that Crystal isn't up to the task as I want it to be and I'll have to settle for something not as nice. Annotations really need some work.
<FromGitter> <Blacksmoke16> is the easy way to do it
<FromGitter> <Blacksmoke16> @watzon https://github.com/crystal-lang/crystal/issues/9802 ❀️
<FromGitter> <Blacksmoke16> regardless you cant build out the initializer based on annotated columns, as you cant access those outside of a mehtod
<FromGitter> <Blacksmoke16> if thats what you're going after
<FromGitter> <watzon> Yeah that sucks. Oh well, I'll just have people define their own initializer and leave it at that for the time being.
DTZUZU has joined #crystal-lang
<FromGitter> <Blacksmoke16> i sent you a message
DTZUZU_ has quit [Ping timeout: 258 seconds]
* FromGitter * erdnaxeli:cervoi.se this does no put anything in y? https://carc.in/#/r/a39z
<FromGitter> <Blacksmoke16> you mean `x`?
<FromGitter> <Blacksmoke16> looks like `y` is the whole array
* FromGitter * erdnaxeli:cervoi.se IΒ mean `y`
<FromGitter> <Blacksmoke16> what are you expecting?
* FromGitter * erdnaxeli:cervoi.se two first values in x, and the last one in y
<FromGitter> <Blacksmoke16> why?
* FromGitter * erdnaxeli:cervoi.se ruby does that
<FromGitter> <watzon> Crystal isn't Ruby though ;) haha
<FromGitter> <Blacksmoke16> ^
* FromGitter * oprypin:matrix.org post, please ignore)
<FromGitter> <watzon> (erongi esaelp ,tsop tset)
* FromGitter * erdnaxeli:cervoi.se agree crystal in not ruby, but we could not deny crystal takes inspiration from ruby :p
<FromGitter> <Blacksmoke16> yes, but only the good things πŸ˜‰
* FromGitter * erdnaxeli:cervoi.se I would have expected everything to be in `x` and not `y`
<FromGitter> <Blacksmoke16> whats the end goal tho? why not just `.each do |y|`
<FromGitter> <Blacksmoke16> and there, `y` has the whole array
<oprypin> well shit, the irc bridge is not equipped to handle some newly changed json responses from gitter api
<oprypin> and i cant recompile it because it's like 3 crystal versions behind
* FromGitter * erdnaxeli:cervoi.se end goal was just trying to run a ruby AoCΒ solution in crystal ^^
* FromGitter * erdnaxeli:cervoi.se IΒ will do `.each do |y|`
* FromGitter * erdnaxeli:cervoi.se why `.each do |*x, y|` puts everything in `y` and nothing in `x` ?
<FromGitter> <Blacksmoke16> nothing to splat so `x` is empty, then rest of stuff goes into `y`?
<FromGitter> <Blacksmoke16> granted idk if that should even compile
* FromGitter * erdnaxeli:cervoi.se I guess because if everything is in `x`, what is the value of `y`?Β but for `y` teh empty value is easy, it's an empty tuple
<FromGitter> <KevinSjoberg> What are people using for editor when programming Crystal? I've tried a couple so far and they all seem to fail with basic indentation.
* FromGitter * erdnaxeli:cervoi.se it should probably not compile
<FromGitter> <Blacksmoke16> @KevinSjoberg sublime with crystal plugin works fine for me
<FromGitter> <Blacksmoke16> formats on save and has highlighting
* FromGitter * erdnaxeli:cervoi.se with crystal plugin but that's not so good. Except highlighting, there is not much.
<FromGitter> <KevinSjoberg> @Blacksmoke16 I'll guess I'll have to try it then. I just spent 2 hours on fixing issues in TextMate. Overall it works great, formats on save as well. But indentation was broken.
<FromGitter> <Blacksmoke16> did you tell it to use 2 spaces?
<FromGitter> <KevinSjoberg> @Blacksmoke16 could you try the following in Sublime for me ⏎ ⏎ ```private class A(T) ⏎ protected def abc``` [https://gitter.im/crystal-lang/crystal?at=5fd14b762a954a51a9bfce27]
<FromGitter> <KevinSjoberg> Does that indent correctly in Sublime?
<FromGitter> <KevinSjoberg> It does now in TextMate (after I fixed it).
<FromGitter> <Blacksmoke16> `syntax error in 'STDIN:2:20': unexpected token: EOF`
<FromGitter> <KevinSjoberg> But Vim has the same problem.
<FromGitter> <KevinSjoberg> Don't save, just hit enter after `abc`
<FromGitter> <KevinSjoberg> I want to see if it automatically indent on enter
<FromGitter> <Blacksmoke16> two spaces in
<FromGitter> <Blacksmoke16> i.e. within method body
<FromGitter> <KevinSjoberg> I'm sold. Switching to Sublime!
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> (test post, please ignore)
<oprypin> whew crisis averted
<FromGitter> <KevinSjoberg> @Blacksmoke16 broke it on first try...
<FromGitter> <KevinSjoberg> ```abstract class A(T)<Hit Enter> ⏎ <cursor here>``` [https://gitter.im/crystal-lang/crystal?at=5fd14df19700c07b17de8d2a]
<FromGitter> <Blacksmoke16> rip
<FromGitter> <Blacksmoke16> you install the plugin i assume?
<FromGitter> <KevinSjoberg> Hmm, but the example I gave above doesn't work either.
<FromGitter> <KevinSjoberg> Yep, I have the Crystal plugin installed.
<FromGitter> <Blacksmoke16> :shrug: worked for me
<FromGitter> <Blacksmoke16> maybe some config option you need to do?
<FromGitter> <KevinSjoberg> Hmm. So `private def abc` works but `abstract def abc` does not. Anything before `class` breaks indentation while `class A` works.
<FromGitter> <KevinSjoberg> Are you seeing the same thing?
<FromGitter> <Blacksmoke16> fwiw if you just keep typing it'll format on save to be correct
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <KevinSjoberg> Yeah, I do the same but it's annoying to press enter and then being in a state where the editor is fighting you.
<FromGitter> <Blacksmoke16> yea dunno, never noticed
<FromGitter> <Blacksmoke16> might be the plugin config somewhere? idk how thats all setup
<FromGitter> <KevinSjoberg> Good news, it's based on TextMate where I fixed this. So PR incoming. :slight_smile:
<FromGitter> <Blacksmoke16> ha nice one
<FromGitter> <KevinSjoberg> There we go, https://github.com/crystal-lang-tools/sublime-crystal/pull/74.
<FromGitter> <Blacksmoke16> πŸŽ‰
<raz> i'm back on vscode. wanted to like sublime, but no live search killed it for me. also the syntax highlighting is kinda weird after coming from vs (doesn't recognize as many keywords)
<straight-shoota> raz, search experience in sublime is a main factor I switched to VS code
<straight-shoota> ... and all that other nice stuff you can do with that sidebar =)
<raz> yea, if only it wasn't so laggy
<oprypin> o man one day i will have to switch to it
<oprypin> just too used to Kate, seemingly the only editor with (filtered) file tree view
<raz> the terrible truth is, search in vscode isn't even good. it's just the bare minimum (realtime search) that you'd expect nowadays
<raz> sublime just doesn't have even that
* raz sad editor noises
<FromGitter> <j8r> oprypin I tried Kate, looks nice, but no Crystal support :(
<oprypin> yea i decide on a file-by-file basis, is Ruby highlighting or Python highlighting less broken in this case
<raz> oh crystal highlighting works fine in vscode. even indentation is pretty solid
<raz> not great, but at least it doesn't screw up constantly ;)
<raz> when you see the amazing things that vscode does for js tho, you get jealous still
<raz> i think vlad was the hero who created the plugin. we should bribe him to polish it up :P
<FromGitter> <j8r> I have Geany, actually using 32MB :) ⏎ Not much advanced features, though
<raz> hm, never heard of that
<oprypin> raz, hm? no
<FromGitter> <j8r> I don't mind spending a bit more time searching, it let me look back at part of my code, and thinking about it
<raz> oprypin: oh, another faust
<FromGitter> <j8r> Another faust not named vlad?
* FromGitter * j8r not making a joke about one named panzer...
<straight-shoota> faustino
<FromGitter> <j8r> Haaa!
<FromGitter> <j8r> We don't see him much now...
<hightower4> did you see Atom editor, I think it's a fork of Sublime or something?
<hightower4> (didn't use it... just know it was a thing, at least a couple years back)
<FromGitter> <j8r> hightower4 VScode is a fork of Atom, sort of now
<oprypin> seems like vscode killed atom?
<oprypin> doesnt matter cuz both are owned by microsoft lol
<FromGitter> <j8r> right, before I was kind of "not fair for GH". But now, "whatever, why there are Atom AND VSCode?!"
<FromGitter> <j8r> also beware, like Chrome, VSCode has corp crap by default
<oprypin> please. i have "Code - OSS"
<oprypin> also i dont use it but whatever
<FromGitter> <j8r> Code - OSS?
<FromGitter> <j8r> liek VSCodium I guess
<FromGitter> <j8r> ...wtf why google result are in French
<FromGitter> <j8r> They know my IP so suppose I want French, look at my browser lang omg...
<oprypin> yes πŸ‘
<oprypin> hate being an honorary German
<FromGitter> <j8r> so your results are germany?
<FromGitter> <j8r> "frenchy" for me
<oprypin> hm actually not, even not logged in
<FromGitter> <j8r> I have literally nothing in French on my PC... maybe the crappy azerty keyboard. ⏎ I don't like sites guessing things on the IP of visitors
<FromGitter> <j8r> it is intrusive, and inaccurate. More than just reading the language in user agent - simple
renich has quit [Quit: Leaving.]
<oprypin> why d u have azerty keyboard?
<FromGitter> <j8r> qwerty kaput
<FromGitter> <j8r> it was one laying around
<hightower4> they get so much things these days from the browser - check https://do-know.com/privacy-test.html
<oprypin> not impressed with that one
<FromGitter> <j8r> me too