ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.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: 268 seconds]
<FromGitter> <sam0x17> there's no faster way for this I'm assuming right? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d65ce19a080d70ab591e173]
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Set.html#concat(elems)-instance-method ?
<FromGitter> <Blacksmoke16> :p
<FromGitter> <sam0x17> that answers my question
<FromGitter> <Blacksmoke16> shh :)
<FromGitter> <sam0x17> haha
<FromGitter> <sam0x17> I feel better about not calling concat now tho xD
<FromGitter> <sam0x17> but yeah if people like `+` being a thing for `Set` I'll submit a PR -- I always end up using it for defining per-character whitelists (handy for the `O(1)` `.includes?`)
<FromGitter> <sam0x17> e.g.:
<FromGitter> <sam0x17> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d65d012a080d70ab591edb3]
<FromGitter> <sam0x17> the additions aren't super efficient but for constants its great
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Set.html#%7C(other:Set(U))forallU-instance-method
<FromGitter> <Blacksmoke16> is prob what you want actually
<FromGitter> <Blacksmoke16> which is pretty much what your `+` is doing
<FromGitter> <sam0x17> ahh
<FromGitter> <sam0x17> still makes me wonder what they hate about + so much lol
lvmbdv has quit [Ping timeout: 272 seconds]
lvmbdv has joined #crystal-lang
<FromGitter> <asterite> I think `+` as an alias for `|`, like in Ruby, is probably good. It's an alias but I think `+` is more intuitive than `|`. There's also `Array#+` and `Array#|` with slightly different semantics, so I think `+` for Set is a good addition
<FromGitter> <sam0x17> @asterite thanks for chiming in -- I'm guessing we also keep `|` for backwards compatibility?
<FromGitter> <sam0x17> oh alias ok yup
<FromGitter> <watzon> I'm confused, are we talking about changing the union syntax?
<FromGitter> <sam0x17> adding a `+` alias for it
<FromGitter> <sam0x17> and your comment proves that people do use the old syntax
<FromGitter> <watzon> I didn't even know there was another syntax
<FromGitter> <sam0x17> there isnt
<FromGitter> <watzon> Ahh ok, guess this is what I get for jumping in late lol
<FromGitter> <watzon> Serious confusion
<FromGitter> <sam0x17> this would be a PR to add `Set.new + Set.new` as the same as `Set.new | Set.new` for example
<FromGitter> <sam0x17> I didn't even realize the union syntax was already a thing -- had always just monkey-patched in a `+`
<FromGitter> <watzon> Ahh ok. I didn't know the pipe syntax was even there for adding sets together. The `+` syntax makes more sense,
<FromGitter> <watzon> I thought we were talking about actual Unions for a bit there
<FromGitter> <sam0x17> ah ok lol your first comment made it sound like you knew about and used the `|` syntax
<FromGitter> <sam0x17> ahhhh
<FromGitter> <sam0x17> gotha
<FromGitter> <sam0x17> now it makes sense
<FromGitter> <watzon> Yeah the pipe syntax doesn't make sense to me, `+` makes a lot more sense
<FromGitter> <sam0x17> the pipe syntax NOW makes some sense to me after this discussion, but I also prefer +
<FromGitter> <sam0x17> lol
<FromGitter> <sam0x17> because union really is addition for sets
<FromGitter> <watzon> Pipes should either be for unions or as a bitwise OR
<FromGitter> <sam0x17> yeah, I also see them and assume we doing stuff with bits or stuff with types
<FromGitter> <watzon> Same with `&`
<FromGitter> <sam0x17> yes
lvmbdv has quit [Ping timeout: 258 seconds]
lvmbdv has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 245 seconds]
chemist69 has quit [Ping timeout: 264 seconds]
chemist69 has joined #crystal-lang
<FromGitter> <watzon> Is there an easy way to sent multipart/form-data with the built in `HTTP::Client`?
<FromGitter> <watzon> I'm use to using Halite, but I'm trying to not have that dependency this time around
sagax has quit [Ping timeout: 245 seconds]
rkeene has quit [Ping timeout: 268 seconds]
<FromGitter> <watzon> I found that, but there's no good usage examples for HTTP::Client
sagax has joined #crystal-lang
<FromGitter> <sam0x17> imo look at kemal source code xD
<FromGitter> <sam0x17> oh except client
<FromGitter> <sam0x17> hmmm
<FromGitter> <sam0x17> https://crystal-lang.org/api/0.30.1/HTTP/FormData.html#build(response:HTTP::Server::Response,boundary=MIME::Multipart.generate_boundary,&block)-class-method tho they are a server for some reason in that example
<FromGitter> <sam0x17> but at least that one passes in an io into a multipart form
<FromGitter> <watzon> It's pretty stupid that it requires passing in a whole request object, but if that's the only way I guess that's the only way
ht_ has joined #crystal-lang
<FromGitter> <sam0x17> you should look at the source code for the methods/classes you are dealing with -- I had something similar with HTTP::Cookies where it was like the easiest monkey-patch cuz its actually stupid simple under the hood
<FromGitter> <sam0x17> I was expecting this indecipherable complex thing
<FromGitter> <sam0x17> a lot of the HTTP classes/structs are just wrappers around simple objects like `Hash` and `Set`
<FromGitter> <sam0x17> it turns out
<FromGitter> <watzon> Yeah MIME::Multipart looks like it's a little more complicated
<FromGitter> <sam0x17> ah I see lol
<FromGitter> <watzon> It's alright, I'll be fine for now
<FromGitter> <sam0x17> to be fair, I've never seen multipart uploads be an easy thing in any language
<FromGitter> <sam0x17> its like everyone designs their API with multipart uploads as a conceptual outlier and then glue it on
ht_ has quit [Quit: ht_]
absolutejam has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> you know
<FromGitter> <absolutejam_gitlab> I really don't like that you can access instance vars without `@`
<FromGitter> <watzon> What do you mean? The only way they should be acceptable without the `@` is as a getter or setter
absolutejam has quit [Ping timeout: 244 seconds]
absolutejam has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> a property I mean
<FromGitter> <absolutejam_gitlab> I didnt know it only worked for properties (getters/setters) tbh, I mostly only use properties atm
<FromGitter> <watzon> Yeah, `getter` and `setter` are really just macros that create basic getter and setter methods. `property` does both. You're not actually accessing the instance variable directly without the `@` and you can emulate the behavior by just creating your own getter/setter methods.
<FromGitter> <absolutejam_gitlab> I guess it makes sense then
<FromGitter> <absolutejam_gitlab> since it's calling a method not accessing a ivar
<FromGitter> <absolutejam_gitlab> so it doesn't need the `@`
<FromGitter> <watzon> Yep. The getter method is really just wrapping the ivar ⏎ ⏎ ```@foo``` [https://gitter.im/crystal-lang/crystal?at=5d663300f2821072aa292988]
<FromGitter> <watzon> Then there's private getter/setter/property, protected getter/setter/property, and class_ versions of each. So `class_getter`, etc.
<FromGitter> <watzon> Just in case you don't know. They can all be pretty helpful.
Human_G33k has joined #crystal-lang
<Human_G33k> hello just a noob question, how crystal is support for old hardware ? i686 to be exact
devil_tux has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <watzon> Good question. I have no idea what the answer is though.
absolutejam has quit [Ping timeout: 268 seconds]
devil_tux has quit [Ping timeout: 268 seconds]
absolutejam has joined #crystal-lang
devil_tux has joined #crystal-lang
sagax has quit [Remote host closed the connection]
ua_ has quit [Ping timeout: 248 seconds]
ua has joined #crystal-lang
<FromGitter> <kalinon> @Blacksmoke16 looking at your assert lib. very nice. What does `{% verbatim do %}` do? I am not familiar with this macro method.
<FromGitter> <kalinon> I see it used in the core... but no docs or anything... hmmm
devil_tux has quit [Ping timeout: 272 seconds]
<FromGitter> <kalinon> hunted down the PR: https://github.com/crystal-lang/crystal/pull/6108
<FromGitter> <Blacksmoke16> Yea Just a cleaner way than like `\{%`
<FromGitter> <kalinon> SO MUCH BETTER
<FromGitter> <kalinon> 🤯
devil_tux has joined #crystal-lang
<FromGitter> <Blacksmoke16> @watzon i think the setter can also be written as `def foo=(@foo : String)`
<FromGitter> <absolutejam_gitlab> @watzon I like `|` for concat
<FromGitter> <absolutejam_gitlab> well, for cons
<FromGitter> <absolutejam_gitlab> Like in Elixir
<FromGitter> <kalinon> @Blacksmoke16 looking at your code ive already learned so much i didnt know about macros in 15 minutes. Thank you.
<FromGitter> <kalinon> like the fact you can do this `{% for assertion in Assert::Assertions::Assertion.subclasses %}` and the verbatim
<FromGitter> <Blacksmoke16> xD np
<FromGitter> <kalinon> Will need to do some refactoring now, but at least i can clean up so much junk
<FromGitter> <Blacksmoke16> there is also `.all_subclasses`, which also returns subclasses of the direct subclasses
<FromGitter> <Blacksmoke16> is where all the good stuff is
<FromGitter> <kalinon> Yeah ive been in there, but i thought you still needed to get it off a `@type` magic var
<FromGitter> <Blacksmoke16> nope any `TypeNode` :)
<FromGitter> <kalinon> <3
devil_tu1 has joined #crystal-lang
<FromGitter> <kalinon> Anything that would let us find all annotations?
<FromGitter> <kalinon> aka all classes with annotation X
<FromGitter> <kalinon> i mean, i could cycle through `all_subclasses` of `Object`
<FromGitter> <Blacksmoke16> but it needs some more refinement on how it should work
<FromGitter> <kalinon> Yeah exactly.
<FromGitter> <kalinon> very cool.
devil_tux has quit [Ping timeout: 272 seconds]
<FromGitter> <kalinon> yeah i can see his point.
<FromGitter> <kalinon> I mean this is gross, but it works: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d66704bbe3a8a311affdb0a]
<FromGitter> <kalinon> lol
hightower2 has joined #crystal-lang
<hightower2> Hey is Crystal supported on ARMv8-A?
<FromGitter> <dscottboggs_gitlab> Crystal's ARM support is a little weak afaik at the moment. It looks like crystal itself is currently only released for x86 and x64 (according to the releases page (https://github.com/crystal-lang/crystal/releases)). The compiler does support cross-compilation though...
<FromGitter> <j8r> hightower2 yes it is
<hightower2> Yeah, on https://github.com/crystal-lang/crystal/wiki/Platform-Support it seems to list aarch64-linux (which I believe includes cortex-a53) as a buildable thing
<hightower2> great, very nice
<FromGitter> <dscottboggs_gitlab> ah nice :)
<FromGitter> <dscottboggs_gitlab> oh wow, that list is longer than the last time I saw it
<FromGitter> <j8r> I compile statically on Alpine aarch64 (with docker QEMU)
<FromGitter> <j8r> there is an issue with LLVM8, but would likely be fixed in the following months
<hightower2> j8r which platform/computer you have for that? (for the actual hardware I mean, not the emulator)
<FromGitter> <j8r> my laptop :)
<hightower2> yes, I'm looking for ideas on which one :)
<FromGitter> <j8r> but it is on intel x86-64 :/
<FromGitter> <j8r> I use this to compile: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d667aa1c8228962acdbb543]
<FromGitter> <dscottboggs_gitlab> what does that do?
<FromGitter> <dscottboggs_gitlab> specifically the second line
<FromGitter> <j8r> I have a MSI laptop, quite old now (GE60 2PE). They can be bought without an OS
<FromGitter> <j8r> @dscottboggs_gitlab AFAIK they register the interpreters to run. If the binary is aarch64, they are executed with QEMU
<FromGitter> <dscottboggs_gitlab> huh. I didn't know you could run containers on other architectures with qemu. That's pretty nifty. I guess I should've figured there was a way considering containerd haha
<FromGitter> <dscottboggs_gitlab> what do you use the arm-built stuff for, if you don't mind me asking?
<FromGitter> <j8r> Yep, but this isn't very safe
<FromGitter> <dscottboggs_gitlab> do you have like a pi cluster or something?
<FromGitter> <dscottboggs_gitlab> the container you're doing the work in doesn't have `--privileged`, what's unsafe?
devil_tu1 has quit [Ping timeout: 245 seconds]
<FromGitter> <j8r> the second like, it may mess up the host
<FromGitter> <j8r> and possibly other containers
<FromGitter> <dscottboggs_gitlab> ah
<FromGitter> <dscottboggs_gitlab> probably better just to dedicate a qemu arm vm to it then
<FromGitter> <j8r> 👍
<FromGitter> <dscottboggs_gitlab> but then file-sync becomes a bitch.... :(
<FromGitter> <j8r> compilation is literally 10x slower :/
<FromGitter> <dscottboggs_gitlab> using qemu?
<FromGitter> <j8r> yes
<FromGitter> <dscottboggs_gitlab> that sucks :(
DTZUZO has quit [Ping timeout: 248 seconds]
ua has quit [Ping timeout: 245 seconds]
ua has joined #crystal-lang
<FromGitter> <Blacksmoke16> http://www.cis.upenn.edu/~bcpierce/unison/ we use this at work to sync our macs with centOS vms
<FromGitter> <Blacksmoke16> is quite more performant
ua has quit [Ping timeout: 245 seconds]
<FromGitter> <j8r> what?
<FromGitter> <j8r> oh I see, I misunderstood for a second 😅
<FromGitter> <Blacksmoke16> yea was going off what @dscottboggs_gitlab was saying
<FromGitter> <j8r> made in OCaml, interesting
<FromGitter> <j8r> what's your opinion on it?
<FromGitter> <Blacksmoke16> granted i dont know much about the details of how it works/is implemented in our vms
<FromGitter> <Blacksmoke16> but i can say it made a huge difference
<FromGitter> <Blacksmoke16> from what we were doing before
<FromGitter> <Blacksmoke16> like our app went from 30 sec cold start with no cached stuff, to like 4
<FromGitter> <Blacksmoke16> before was NFS afaik
<FromGitter> <j8r> but you have installed it in your OS?
<FromGitter> <j8r> NFS is good too, it's implemented in the kernel
<FromGitter> <Blacksmoke16> i dont really know
<FromGitter> <j8r> O.o you don't really know how your files are synced to servers?
<FromGitter> <Blacksmoke16> its for our dev machiens
<FromGitter> <Blacksmoke16> and someone else did it as a hackathon project, so im not super familiar with how it all works
<FromGitter> <j8r> if the VM locally, you don't need that. Just have a mount point
<FromGitter> <Blacksmoke16> possibly, im sure there's a reason why
ua has joined #crystal-lang
devil_tux has joined #crystal-lang
devil_tux has quit [Ping timeout: 245 seconds]
sagax has joined #crystal-lang
devil_tux has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d66a20868406739f99b04c8]
<FromGitter> <Blacksmoke16> thats a new one
<FromGitter> <Blacksmoke16> seems something just got cached incorrectly
<FromGitter> <bararchy> Is there a way for crystal-db to translate back a composite type from DB to crystal object ?
<FromGitter> <Blacksmoke16> i think it supports converters, if that is what you want?
<FromGitter> <Blacksmoke16> er that might just be for `DB.mapping`
<FromGitter> <Blacksmoke16> http://crystal-lang.github.io/crystal-db/api/0.6.0/DB.html#mapping(properties,strict=true)-macro
<FromGitter> <Blacksmoke16> depending how you have it setup, could prob do something similar with a module and `.from_rs` method
teardown has joined #crystal-lang
<FromGitter> <bararchy> It seems the DB returns a BLOB type, and it won't get converted
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 245 seconds]
hightower2 has quit [Ping timeout: 258 seconds]
<FromGitter> <Blacksmoke16> wouldnt that just be the db version of Bytes?
devil_tux has quit [Ping timeout: 268 seconds]
devil_tux has joined #crystal-lang
devil_tux has quit [Ping timeout: 245 seconds]
<FromGitter> <absolutejam_gitlab> V n
sorcus has quit [Quit: WeeChat 2.5]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter> <Blacksmoke16> before publishing it
<FromGitter> <bcardiff> @Blacksmoke16 from the json output it's not clear if I can get the validation errors of a specific property (for example to show inline errors in a form). And there is a wierd `"@actual": PropertyType` in the second snippet.
<FromGitter> <Blacksmoke16> `"@actual": PropertyType` is mentioned in the bullet points below. is a helper macro that makes generating the required initializer easier. Would it help if i also added a comment above it?
<FromGitter> <Blacksmoke16> hmm, and no. that would have to be implemented. if you're doing server rendered forms there would be a way to have access to the failed assertions
<FromGitter> <Blacksmoke16> there is*
<FromGitter> <Blacksmoke16> or you could also override the JSON format
<FromGitter> <Blacksmoke16> ill mention that
hightower2 has joined #crystal-lang
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d66cf643c1aba311be9c533]
<FromGitter> <Blacksmoke16> for example
<FromGitter> <bcardiff> @Blacksmoke16 mentioning that is in the roadmap is enough to me :-). ⏎ regarding the initalize macro. you are right, I skip that is was not a `def`. But the quotes and the `@` was really werid to my eyes. I wonder if there is another syntax with a bit less friction.
<FromGitter> <Blacksmoke16> @bcardiff the custom JSON format is already doable. And my bad, i meant to say there is already a method that returns failed assertions. I added a few sentences for both
<FromGitter> <Blacksmoke16> ```code paste, see link```
<FromGitter> <bcardiff> 👍
<FromGitter> <Blacksmoke16> do you know of any better way for the macro? currently its basically just using a `**args` and doing like `{{key.id}} : {{value.id}}`
<FromGitter> <Blacksmoke16> which the `@` symbol isnt a valid key
<FromGitter> <Blacksmoke16> sometimes you also have to quote the body, mostly if using nilable types with default value https://play.crystal-lang.org/#/r/7gs2
<FromGitter> <Blacksmoke16> the value*
<FromGitter> <Blacksmoke16> i guess i could add the `@` behind the scenes
<FromGitter> <Blacksmoke16> would clean it up a bit
<FromGitter> <Blacksmoke16> imma do that
absolutejam has joined #crystal-lang
sagax has quit [Quit: Konversation terminated!]
sagax has joined #crystal-lang
devil_tux has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
devil_tux has quit [Ping timeout: 272 seconds]
Stephie has quit [Quit: Fuck this shit, I'm out!]
Vexatos has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
Stephie has joined #crystal-lang
hightower2 has quit [Ping timeout: 246 seconds]
absolutejam has joined #crystal-lang
sagax has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
DTZUZO has joined #crystal-lang
absolutejam has quit [Ping timeout: 272 seconds]
absolutejam has joined #crystal-lang
teardown has quit [Ping timeout: 245 seconds]
Raimondi has quit [Quit: WeeChat 2.5: ¡Chau!]
Raimondi has joined #crystal-lang
absolutejam has quit [Ping timeout: 272 seconds]
hightower2 has quit [Ping timeout: 272 seconds]