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
faitswulff has joined #crystal-lang
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
return0xe has quit [Ping timeout: 252 seconds]
return0e has joined #crystal-lang
faitswulff has quit [Remote host closed the connection]
return0e has quit [Ping timeout: 240 seconds]
return0e has joined #crystal-lang
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 240 seconds]
faitswulff has joined #crystal-lang
faitswulff has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
notdaniel has quit [Ping timeout: 245 seconds]
faitswulff has joined #crystal-lang
notdaniel has joined #crystal-lang
faitswulff has quit [Ping timeout: 252 seconds]
dkh has joined #crystal-lang
notdaniel has quit [Ping timeout: 260 seconds]
dkh has quit [Ping timeout: 240 seconds]
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 240 seconds]
druonysus has joined #crystal-lang
_whitelogger has joined #crystal-lang
ua has quit [Ping timeout: 252 seconds]
ua has joined #crystal-lang
codenoid has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
codenoid has quit [Ping timeout: 272 seconds]
ashirase has quit [Ping timeout: 252 seconds]
ashirase has joined #crystal-lang
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 264 seconds]
<FromGitter> <bew> lol fun metric
moei has quit [Ping timeout: 252 seconds]
DTZUZO_ has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <j8r> @jwoertink you have put the app in a single big instance? Why not putting it in small ones in an ASG?
<FromGitter> <j8r> And behind an ELB, you'll have stats, and HA
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 260 seconds]
moei has joined #crystal-lang
<FromGitter> <codenoid> so quiet
DTZUZO_ has joined #crystal-lang
faitswulff has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
<kevinsjoberg> What type annotation do I need to use to accept any class that respond to `from_json`. I tried doing: "serializer_class : Object.class". But it crashes my code when I do serializer_class.from_json(body).
<FromGitter> <bew> Don't put type restrictions
faitswulff has quit [Remote host closed the connection]
kevinsjoberg has quit [Quit: Textual IRC Client: www.textualapp.com]
faitswulff has joined #crystal-lang
<FromGitter> <KevinSjoberg> @bew that doesn't do it. Then I get `Can't infer the type of instance variable`.
<FromGitter> <KevinSjoberg> Basically, I have a class that take a class responding to `.from_json(string_or_io)`, which is any `Object`.
<FromGitter> <bew> Oh
<FromGitter> <bew> You need to know the real type of `@serializable`, you could make a generic class
<FromGitter> <bew> Like `class ResourceResponse(T)` and then use `T.class` as the restriction i guess
<FromGitter> <KevinSjoberg> I see, that makes sense. Let me try that. :)
<FromGitter> <bew> (i'm on a phone, can't easily try)
<FromGitter> <KevinSjoberg> @bew thanks a lot. Worked perfectly. :)
<FromGitter> <bew> Cool ;) you're welcome
<FromGitter> <r00ster91> does stuff like `../`, `./` not work in `File.open`? It looks like `File.open` only opens files of my current shell path where im running the crystal file. Can I somehow change that `File.open` opens files that are in the same path? Instead of that its aiming my path
<jhass> r00ster91: you could use __DIR__ as a base if I get you right, though I would reconsider this approach given the goal is to render a binary and that would then depend on being run on exactly your system setup
<FromGitter> <proyb6> @levex
<FromGitter> <proyb6> @KevinSjoberg , I’m curious how does the code looks like?
<FromGitter> <proyb6> D
<FromGitter> <r00ster91> jhass: thanks `Dir` actually works very good for this
<FromGitter> <KevinSjoberg> @proyb6 like this now: https://gist.github.com/KevinSjoberg/4d81ff64e4f3e29a578467a073ee683f.
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
<FromGitter> <levex> huh?
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
JuanMiguel has joined #crystal-lang
<FromGitter> <proyb6> @levex
<FromGitter> <levex> Hello, that’s me
<FromGitter> <proyb6> Sorry for the wrong address, I was referring to Kevin
<FromGitter> <levex> Oh, no problem :-)
<FromGitter> <proyb6> keyboard is quite jerky in Gitter unlike Slack app
<FromGitter> <Sija> @levex While you’re here, come join Crystal party ;)
<FromGitter> <levex> I mean, there’s a reason why I’m part of this Gitter :-)
<FromGitter> <Sija> I haven’t seen you here before thus I came to conclusion you’ve been summoned from other parts of the Gitter-verse ;)
<FromGitter> <proyb6> @kevinelliott
<FromGitter> <Sija> @levex So, when is CrystalOS happening? :P
<FromGitter> <proyb6> @KevinSjoberg
<FromGitter> <proyb6> Great thanks!
<FromGitter> <levex> @Sija when I or someone interested in osdev starts working on it ;)
<FromGitter> <levex> at this point in time, i am preoccupied with Rust, but I’ve been meaning to give a better look at Crystal...
<FromGitter> <levex> Since I’m flying most of this weekend, I might actually just give it a try
JuanMiguel has quit [Quit: This computer has gone to sleep]
<FromGitter> <Sija> Please do and report back :) I’d love to hear how does it seem from Rust-ian perspective (well, aside of GC which is a pretty obvious win for Rust)
<FromGitter> <KevinSjoberg> Is there a way to share data between specs?
<FromGitter> <j8r> In the `it ... do` block?
<FromGitter> <j8r> Declare the variable on the top level
<FromGitter> <KevinSjoberg> @j8r sure, but will that variable be local to the test or declared globally?
<FromGitter> <j8r> That's sad often PR in Crystal gets idle, even when there are the 2 approvals, for no reason
<FromGitter> <j8r> You can declare it after the `describe MyClass`
<FromGitter> <j8r> If you want it global-global
<FromGitter> <j8r> You can put it in the `spec_helper.cr`, that is required by all specs
<FromGitter> <j8r> Better to consider it read-only
<FromGitter> <KevinSjoberg> @j8r i just want it encapsulated to my tests, not leaking to anything else. I've put within the `describe` block. I'd assume that will do it.
<FromGitter> <KevinSjoberg> While were at it, how come constants and classes can't be defined within the block?
<FromGitter> <KevinSjoberg> I'm coming from Ruby, som bare with me. :)
<FromGitter> <j8r> It's obvious for constants, they are global constants
<FromGitter> <j8r> For classes, they can't be declared dynamically
<FromGitter> <KevinSjoberg> @j8r oh, I thought declaring things within `describe` would not make it global. That explains things.
<FromGitter> <KevinSjoberg> in Ruby, `describe` will generate an anonymous class. Since we can't do this in Crystal it makes sense we're in the global top level context. I guess? :slight_smile:
<FromGitter> <j8r> Hum, yes for variables. But the compiler won't like it if you declare a CONST inside
<FromGitter> <j8r> yes, describe in fact is a top level method, which accept a block
<Yxhuvud> I don't see any reason for why crystal wouldn't be able to generate classes with macro in the specs, but currently it is quite minimal and doesn't. There are plenty of spec expansions out there - perhaps some of them do?
<FromGitter> <j8r> You can generate classes, but before the describe, in the top level
<FromGitter> <jwoertink> @j8r we only put it on a big instance because we didn't know how it would handle. We will be resizing the instance, and reconfiguring. It initially started as a test which we kept pushing until it turned in to a full blown production app lol
Yxhuvud has quit [Ping timeout: 240 seconds]
<FromGitter> <j8r> Ok, nice! Keep it mind if the instance/app crash, you lose instantly a part of the million requests/day
<FromGitter> <j8r> Glad to hear success stories like yours 😁
<FromGitter> <sam0x17> if I have a C .o file compiled in a sub directory of my project in `[project root]/tiny-AES-c/aes.o` and the header in `[project root]/tiny-AES-c/aes.h`, is this the proper `lib` syntax for linking with that library (from `[project root]/src/wrapper.cr`)? ⏎ ⏎ ``` @[Link("../tiny-AES-c/aes.o")] ⏎ lib AES ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5ba679eef4bd1056ac9f901c]
<FromGitter> <sam0x17> it doesn't seem to throw any errors no matter how I write the path
<FromGitter> <bew> you need to precise `ldflags`: `@[Link(ldflags: "../path/to/aes.o")]`
<FromGitter> <sam0x17> ah ok
<FromGitter> <r00ster91> https://github.com/crystal-lang/crystal/blob/5c2894298612bdbf53b1543ce07ef784b461d6ae/src/string.cr#L4214 ⏎ does somebody knows what exactly is `@c`? is it an `Array(UInt8)`?
<FromGitter> <r00ster91> oh it seems to be an UInt8
<FromGitter> <bew> this is part of the magic behind the String type, `@c` is the first byte of the string
<FromGitter> <bew> so getting `pointerof(@c)` gets you a pointer to the string
<FromGitter> <r00ster91> oh the first byte. thats interesting
<FromGitter> <sam0x17> how do I declare a fixed size array (as a field in a struct for use with a C API)?
<FromGitter> <bew> `foo : UInt8[5]`
<FromGitter> <r00ster91> Im trying to implement `Char#*`. So far my code works with ASCII characters but not with unicode characters. ⏎ I'm currently stuck at this line: https://github.com/crystal-lang/crystal/blob/5c2894298612bdbf53b1543ce07ef784b461d6ae/src/string.cr#L2512 ⏎ `to_unsafe` returns a pointer to the first byte of the string ⏎ so I tried this: ⏎ ... [https://gitter.im/cry
<FromGitter> ... stal-lang/crystal?at=5ba6825233da0f649e3a7b17]
<FromGitter> <sam0x17> @bew for some reason that is not working: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ `Syntax error in src/wrapper.cr:8: expecting identifier 'end', not 'RoundKey'` [https://gitter.im/crystal-lang/crystal?at=5ba6829a0cfe7f30f1d23b27]
<FromGitter> <bew> the field must start with a lowercase letter
<FromGitter> <sam0x17> but in the C it does not?
<FromGitter> <bew> it doesn't matter, what only matter is that you reproduce the same memory layout of the struct, with the same types
<FromGitter> <bew> the names doesn't matter
<FromGitter> <sam0x17> oh ok cool
<FromGitter> <sam0x17> also is there a way I can #define something to trigger an effect in the C library? this library will compile a certain way if a certain name is defined, and I need to trigger that
<FromGitter> <bew> hmm you could try with constants, and check with macros if the constant is defined or not, or sth like that
<FromGitter> <sam0x17> basically I need to inject `#define AES256` into the code, but I'd prefer not to literally do that but do that somehow from crystal https://github.com/kokke/tiny-AES-c/blob/master/aes.h#L32
<FromGitter> <bew> @r00ster91 note: using `Char#bytes` is *very* inefficient, as it'll create an array..
<FromGitter> <r00ster91> im currently just trying to make it work with unicode characters. I will think about optimization later but thanks for the hint
<FromGitter> <sam0x17> if I define a constant in my `lib` body, will that get moved over to C as a `#define`?
<FromGitter> <bew> instead you can use `each_byte` with a block
<FromGitter> <bew> @r00ster91 ^
<FromGitter> <bew> (that's how `bytes` in implemented)
<FromGitter> <sam0x17> or no, it's a macro directive, so that wouldn't make sense
<FromGitter> <bew> @sam0x17 what do you mean "moved to C" ??
<FromGitter> <sam0x17> I'm not even sure anymore
<FromGitter> <sam0x17> lol
<FromGitter> <bew> x)
<FromGitter> <sam0x17> I'm just gonna use a shell script to append `#define AES256` to the beginning of the C header file when it compiles and then remove it after compilation
<FromGitter> <sam0x17> I don't think it would even be possible to do it from crystal
<FromGitter> <sam0x17> as it has to happen when the library is compiled
<FromGitter> <bew> waat? you don't need the header C file when compiling Crystal
<FromGitter> <sam0x17> when I compile the library I need it
<FromGitter> <sam0x17> I don't need it in crystal
<FromGitter> <sam0x17> I have a git submodule that contains the C library and compiles it so the crystal library could link with it
<FromGitter> <bew> ah, you can define it at compile time iirc, like `clang -c -DAES256 the_lib.c` or sth
<FromGitter> <sam0x17> yeah
<FromGitter> <sam0x17> oh
<FromGitter> <sam0x17> so is there something I can pass to GCC that will do `#define AES256`?
<FromGitter> <sam0x17> that would be much more elegant than modifying the source code on the fly
<FromGitter> <bew> from what i remember, yes
<FromGitter> <bew> oh yes
<FromGitter> <sam0x17> side note: would be great if crystal had something like node-gyp
<FromGitter> <bew> (for gcc)
<FromGitter> <sam0x17> thanks!
<FromGitter> <girng> i was thinking of buying a small SSD off amazon for dirt cheap, just for linux (to write my crystal server stuff in). what do you guys use for your OS? and what would you recommend?
<FromGitter> <girng> actually, now that i think of it. would be wise for me to use the same OS as the server (VPS) uses, when crystal is built? for example, on my vps, i use a debian 8 64-bit minimal template. so i should probably use Debian for workstation, or does it really matter?
<FromGitter> <sam0x17> I would use ubuntu, having started with ubuntu, tried moving to arch linux, tried some other things, and eventually came running back to ubuntu
<FromGitter> <sam0x17> for server alpine linux is technically the best but it's annoying to configure -- there are some good docker images though
<FromGitter> <sam0x17> but if you are setting up your own server would just go ubuntu
<FromGitter> <sam0x17> when googling for issues, you will actually find people with the same problem
<FromGitter> <sam0x17> debian obviously would work too, as ubuntu is debian based
<FromGitter> <girng> i see. i also was reading ubuntu has "more support" for hardware stuff, like my old wifi adapter, etc
<FromGitter> <sam0x17> yes
<FromGitter> <girng> ok thanks man. i will prob do ubuntu :D
<FromGitter> <sam0x17> for a better UI I would recommend ubuntu budgie which uses budgie desktop https://ubuntubudgie.org/
<FromGitter> <girng> watching a video about that now
<FromGitter> <sam0x17> the built in terminal is amazing
<FromGitter> <sam0x17> tilix
<FromGitter> <bararchy> What's going on with all the hyber PC issues Oo
<FromGitter> <girng> i'm so used the same "Default" look of stuff, in windows for example. so i will have to get used to the new UI
<FromGitter> <sam0x17> I've tried ubuntu gnome, ubuntu budgie, elementary OS (tries to be ubuntu with OSX-like look and simplicity), xubuntu (uses xfce desktop), lubuntu (lxde desktop) and others, budgie is the only one I would actually use other than vanilla. Also if you are looking for skins arc-darker is the only one I always come back to you can install it from a PPA
<FromGitter> <girng> @bararchy lol i just saw that one
<FromGitter> <girng> @sam0x17 is that c linkage?
<FromGitter> <sam0x17> yes, my current struggle
<FromGitter> <girng> can't get the current path to the .o?
<FromGitter> <girng> maybe try adding a `../` or `./`
<FromGitter> <bew> replace `PWD` by `__DIR__`
<FromGitter> <sam0x17> haha nice was about to ask this question
<FromGitter> <girng> @sam0x17 check that out!
<FromGitter> <sam0x17> so yeah doing relative paths it can never find the file
<FromGitter> <sam0x17> I was going to try to write a macro to get PWD and put it into a literal
<FromGitter> <sam0x17> @girng lol oh god
<FromGitter> <bew> @girng please noo x)
<FromGitter> <girng> haahhah
<FromGitter> <sam0x17> the argument of ldflags: must be a string literal, so can't do any concatenation except via macro
<FromGitter> <Sija> geez, wtf is going on with this recent trolling?! today we have another strike of this weirdo, now it’s “sexual tolerance”...
<FromGitter> <bew> some crap again in the github issues >< @RX14 @bcardiff @jhass
<FromGitter> <girng> @sam0x17 actually.. i'm going to just partion this ssd i got, then install ubuntu bridge on it
<FromGitter> <girng> bungie**
<FromGitter> <Sija> @RX14 @bcardiff @jhass please, this time ban these usernames and report them as abuse to GH
<FromGitter> <sam0x17> where did this happen?
<FromGitter> <sam0x17> @girng nice!
<FromGitter> <Sija> @sam0x17 on the crystal issue tracker
<FromGitter> <Sija> actually I’d suggest everyone to report these usernames for abuse
<FromGitter> <Sija> that might help raising visibility of the issue for GH mods
<FromGitter> <Blacksmoke16> lol thats an ok hand isnt it
<FromGitter> <Blacksmoke16> 👌
<FromGitter> <bararchy> As a Jew I find it inoffensive ;)
<FromGitter> <Blacksmoke16> all i see on chrome is a white rectangle :(
<FromGitter> <Sija> some refer to it as 6(66) sign, but c’mon
<FromGitter> <bew> thanks @asterite!
<FromGitter> <bew> (for closing those issues)
<FromGitter> <proyb6> Organizations can now ban abusive user in Github, if need.
<FromGitter> <Sija> yeah, they’d need to ban not one but many of them since this weirdo is a puppetmaster of some soty
<FromGitter> <vladfaust> Congrats with such level of attention :D
* FromGitter * Blacksmoke16 just shakes his head
<FromGitter> <KevinSjoberg> I'm trying to think about the best way to add some custom logic into an initializer of the `JSON.mapping` macro. Basically, I want to create an overloaded `initialize` that takes `HTTP::Client:Response` and `JSON::PullParser`. Set the instance variable `@response` and then let the original initializer do its thing. Any ideas?
<FromGitter> <bcardiff> Some emojis raise concerns in minorities. Because the default are the mayorities. Emojis are evolving to include more diversity. For mayorities this might seems like the "yellow"/simpsons-like emoji ends up like neutral, since there are more white versions. But for minorities using the very same emoji that traditionally represent the mayority does not work. ⏎ ⏎ Since I am a mayority sometimes I fail to
<FromGitter> ... see the issue, or simply ignore that can be offending someone. That is something to train. But I don't feel the approach of how issues are reported is the more welcoming to know/understand the resons behind it.
<FromGitter> <Blacksmoke16> @KevinSjoberg when using `.from_json` i assume?
<FromGitter> <KevinSjoberg> You're correct.
<FromGitter> <vladfaust> @bcardiff this is trolling, no need to deeply think of it
<FromGitter> <Sija> @bcardiff that’s clearly an attack by some sort of destabilised individual
<FromGitter> <Sija> So far we have these usernames taking part in it: githubnaziwatchmovement, slammerhammer, M-BoloDyebambewe, benixlinux, NaamanIskowitch, spillednothing, socqse
<lvmbdv> mayority sounds like mayo + majority
<FromGitter> <Blacksmoke16> @KevinSjoberg its not documented real well (or at all afaik) but if you use ` include JSON::Serializable` instead of the `JSON.mapping` you can define an `after_initialize` method that will run after the `.from_json` initializer
<FromGitter> <Blacksmoke16> but the structure/syntax for that is a bit diff than the mapping, see https://crystal-lang.org/api/0.26.1/JSON/Serializable.html
<FromGitter> <vladfaust> It may also be some kind of post-irony, like laughing out those minorities
<lvmbdv> can I post a maymay to lighten the mood
<FromGitter> <Blacksmoke16> get some bongo cat in here
<FromGitter> <bew> a what?
<lvmbdv> a meme
<FromGitter> <Sija> @bcardiff @jhass @ysbaddaden Would you do community a favor and just ban all of these usernames?
<lvmbdv> issa cat meme
<FromGitter> <KevinSjoberg> @Blacksmoke16 thanks, that would do it. Can't help but wonder if it's going to stay there. Either the `JSON.mapping` macro should define it as well or I'd assume it's going away since it's not documented.
<FromGitter> <Blacksmoke16> iirc JSON.mapping is being replaced with the serializeable stuff
<FromGitter> <KevinSjoberg> Oh, I see.
<FromGitter> <Blacksmoke16> but i could be wrong, @as
<FromGitter> <KevinSjoberg> Isn't `after_initialize` awfully generic as well? I mean, given you can have multiple initializers.
<FromGitter> <KevinSjoberg> I'm just thinking out loud. Appreciate the help anyways. :slight_smile:
<FromGitter> <Blacksmoke16> :shrug: wonder what would happen if you had both yaml/json serializable with an after_initalize each
<FromGitter> <bew> @KevinSjoberg it's actually used only in the json initializer, it won't affect other initialize methods
<FromGitter> <bew> @Blacksmoke16 what difference would you have?
<FromGitter> <KevinSjoberg> @bew that I understood, but given someone sees this in the code, it's not clear that `after_initialize` only affect the overloaded initializer for the JSON mapping.
<FromGitter> <kirbyfan64> What the hell is up with the issue tracker right now 😆
<FromGitter> <KevinSjoberg> `after_serialization` would perhaps be more clear? Just a thought.
<FromGitter> <bew> yeah, the name should be changed
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/blob/391785249f66aaf5929b787b29810aeb4af0e1e8/src/yaml/serialization.cr#L236 same method is called in the yaml serrialization, so was wondering if they would conflict
<FromGitter> <bew> @kirbyfan64 no idea ><
<FromGitter> <girng> @KevinSjoberg concern trolls
<FromGitter> <KevinSjoberg> @girng haha, not at all. I obviously prefer the name to be changed. :slight_smile:
JuanMiguel has joined #crystal-lang
<FromGitter> <Blacksmoke16> `after_json_serialization`
<FromGitter> <Blacksmoke16> would be most clear imo
<FromGitter> <KevinSjoberg> @bew would that be something for a pull request or does this have to be discussed further if at all going forward?
<FromGitter> <girng> Oh lol well I guess, their style of reporting is the "troll" part i guess. That one guy said I was a racist
<FromGitter> <KevinSjoberg> @girng what? I think we're talking about different things right now.
<FromGitter> <girng> sorry i thought u meant the recent issue spam
<FromGitter> <KevinSjoberg> Oh, communication mismatch. I'm deep into code atm.
<FromGitter> <girng> @KevinSjoberg WOW i meant to tag @kirbyfan64 not u lol
<FromGitter> <girng> ok that's my bad fail!
<FromGitter> <proyb6> I wish the chat system has different channels like Slack: General, Random, Issues, etc
wontruefree has joined #crystal-lang
<FromGitter> <Sija> 👍
<oprypin> uhh
<FromGitter> <proyb6> Like Discord
<FromGitter> <kirbyfan64> Gitter has an IRC bridge? Huh never knew
<FromGitter> <girng> I heard if they are on irc they suffer if we post images and then edit them lol
<oprypin> kirbyfan64, i have an irc bridge
<FromGitter> <KevinSjoberg> @Blacksmoke16 just realised `after_initialize` does not help me. Since I don't have a reference to my `HTTP::Client::Response` anymore.
<FromGitter> <Blacksmoke16> set the response to an instance var?
<FromGitter> <bew> do you have a short example of what you're doing?
<FromGitter> <KevinSjoberg> @bew I solved it. I'm way to tired now. I was thinking about it all wrong. This is what I came up with: https://gist.github.com/KevinSjoberg/b0b7f8c10543e0f277a690c4e4c3c9d0
<FromGitter> <KevinSjoberg> What I wanted to do was create an new instance from a HTTP response and still have a reference to it.
<FromGitter> <Blacksmoke16> pretty legit, nice one
<FromGitter> <bew> @KevinSjoberg `response` is not defined in you class though
<FromGitter> <KevinSjoberg> @bew it is now. :slight_smile:
<FromGitter> <girng> why is `include JSON::Serializable` required, when `require "json"` is used?
<FromGitter> <bew> the include basically says that this class should have json (de)serialization methods
<FromGitter> <girng> i see. i was just thinking of the `@[JSON::` part would indicate deserialization methods already
<FromGitter> <bew> that thing is an annotation only, it's a kind of metadata attached to something. In the case of json/yaml serialization, the annotation is only useful when you need to configure the field differently from the defaults. You could have a class that is json serializable, with no `@JSON::Field(...)]` in it, and the macros generating the json (de)serialization methods will just use default config
<FromGitter> <bew> checkout the examples in https://crystal-lang.org/api/0.26.1/JSON/Serializable.html
<FromGitter> <j8r> please @crystal-lang ban this users https://github.com/crystal-lang/crystal/issues/6776
<FromGitter> <j8r> (not @asterite the other :) )
<FromGitter> <bcardiff> I can enable the 'Limit to prior contributors' for 24 hours.
<FromGitter> <girng> @bew thanks for explanation. iuno it just looks redundant to me that's all lol. no big deal
<FromGitter> <Sija> @bcardiff sounds sensible
<FromGitter> <j8r> or another option is to report them as users
<FromGitter> <bew> @bcardiff it seems to have stopped, but maybe do that if it happens again
<FromGitter> <j8r> no, 5 min ago new issue
<FromGitter> <bcardiff> like in #6777 ?
<FromGitter> <Sija> @bew, nah there’s another one
<FromGitter> <bew> ah
<FromGitter> <bew> > <
<FromGitter> <j8r> let's report it
<FromGitter> <bew> `><`
<FromGitter> <Sija> please report it
<FromGitter> <Sija> @bcardiff btw, why not ban them?
<FromGitter> <girng> repo owners can't ban, only gh mods
<FromGitter> <Sija> @girng yes, they can
<FromGitter> <girng> no they can't
<FromGitter> <j8r> I've sended a report `Spam issues for illegitimate "albeist" reasons`
<FromGitter> <j8r> I didn't know the word before, it's a valid reason, but the spam not
<FromGitter> <Sija> @girng Please, do your homework before posting
<oprypin> ok but like creating a new account is a thing
<FromGitter> <j8r> yeah do the blocking use @bcardiff please ,if you can
<FromGitter> <Sija> @oprypin true but in this way I reckon they’ll be faster noticied (and possibly banned) by GH mods
<FromGitter> <girng> i see, well that's something new they must have recently added AFAIK
<FromGitter> <bcardiff> Temporary interaction limits: Limit to prior contributors. Enabled for the next 24hs.
<oprypin> we can only hope that this is temporary..
<oprypin> i don't like this though, displaying weakness https://github.com/crystal-lang/crystal/commits/master
<FromGitter> <girng> > An owner of this repository has limited the ability to comment to users that have contributed to this repository in the past. ⏎ rip girng :D heyyy merge my BLUR PR and i'll be ok 😆 jk jk i need to stop getting involved in drama and work on my project lolz
<FromGitter> <j8r> the change was fine @oprypin
<FromGitter> <j8r> but i agree to necessary
<oprypin> that wasnt the point
<FromGitter> <Blacksmoke16> the guy who posted that issue was a lot more civil
<FromGitter> <girng> btw, has @faustinoaq been on lately?
<oprypin> and it also bypassed codereview
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/6767 which is how they should be handleing their issues if they weren't trolling imo
<FromGitter> <j8r> oh yes missed this
<oprypin> yes but it was just the beginning of the troll invasion
<FromGitter> <bcardiff> I hope Limit to prior contributors will cool down things. If not, blocking might come. But I prefer to avoid that feature as much as possible.
<wontruefree> is there a testunit implantation in the std lib?
<FromGitter> <Sija> there’s still #6777 to close
<oprypin> wontruefree, it's called "spec" everywhere
<oprypin> bcardiff, from what @girng says maybe blocking is not so good if only people with previous *commits* are allowed
<wontruefree> so there is no supported testunit?
<oprypin> wontruefree, what is "testunit"
<wontruefree> minitest
<wontruefree> assert style syntax
<FromGitter> <bew> this looks like support, no?
<FromGitter> <j8r> @Sija don't heat the trolls
<oprypin> wontruefree, you can depend on that library if you want
<FromGitter> <Blacksmoke16> theres a shard for that https://github.com/ysbaddaden/minitest.cr
<FromGitter> <Blacksmoke16> which you already found it seems
<oprypin> in standard library there is only one particular style of spec
<FromGitter> <girng> @bcardiff i know there was a spammer in the github repo last year. they made it so only accounts that are older than 24 hours had access to post
<wontruefree> that makes sense to test the std lib
<wontruefree> I was just curious if I had to use a library or if the syntax would be supported
<FromGitter> <girng> godot github repo*
<wontruefree> I dont mean for the std lib to change just if it was avalible for other projects
<oprypin> wontruefree, unittests are supported only in one particular flavor. you can read about it here: https://crystal-lang.org/api/Spec.html
<FromGitter> <Sija> @bcardiff would you mind closing and locking #6777?
<wontruefree> I am guessing if it has not made it in as an option for projects yet there are no plans to add it to the std lib
<wontruefree> what I am looking for is the assert syntax mostly
<FromGitter> <Blacksmoke16> would have to use a shard yea
<FromGitter> <Blacksmoke16> that adds that ability
<wontruefree> ok
<FromGitter> <vladfaust> Hey guys, I've deployed initial version of https://crystaljobs.org/, take a look please :)
<oprypin> what does it do though?
<FromGitter> <vladfaust> Hm
<FromGitter> <girng> btw, @Sija I understand where you were coming from yesterday in my thread, but I was a bit heated and so I acted in a unprofessional manner, but it was in the heat of the moment type of thing, and I hope you understand. I would like to offer truce to you so we can forget about the past and start fresh, no hard feelings.
<FromGitter> <vladfaust> It's currently just a list of developers who are hireable
<FromGitter> <Blacksmoke16> how do you get added to the list
<FromGitter> <vladfaust> There is a log in button
<FromGitter> <Blacksmoke16> ah based on github stuff
<FromGitter> <vladfaust> It's changeable!
<FromGitter> <Blacksmoke16> nice
<FromGitter> <vladfaust> You can add your about text and change the website
<FromGitter> <vladfaust> And it's premoderated, I approve accounts manually at the moment. To avoid spam
<FromGitter> <j8r> the problem isn't finding people, it's finding hirers
<FromGitter> <vladfaust> I know. But it has to start at some point
<FromGitter> <j8r> :)
<FromGitter> <vladfaust> VueJS started from devs list as well
<FromGitter> <girng> @vladfaust that is a very cool site. good job! now just wait for crystal to get out more and more, it will flourish i'm sure.
<FromGitter> <vladfaust> And then it converted to jobs list
<FromGitter> <vladfaust> Thank you, @girng
<FromGitter> <vladfaust> It's open source, btw
<FromGitter> <girng> @vladfaust it's also minimalist, fast, and no bs like some sites. i like it
<FromGitter> <girng> it's simple, which i like
<FromGitter> <vladfaust> Tried my best :)
<FromGitter> <Sija> @girng truce accepted ;)
<FromGitter> <girng> @Sija :)
JuanMiguel has quit [Quit: This computer has gone to sleep]
<oprypin> girng, you've been quite good at providing runnable examples, but people can still get angry... in that recent case I could see the point of view of that person: they regretted the time wasted due to lack of information (not mentioning WSL).
<oprypin> i've been thinking about this, and maybe this tip will be helpful (though it's really hard to follow it, for myself as well). just need to put yourself in the shoes of the person who is trying to help you - maybe some context is missing and it's not even possible to be helpful? imagine yourself talking to a stranger and explaining everything from scratch and then imagine what the stranger would understand from it without having all the information that's
<oprypin> stored in your head.
<FromGitter> <baob> @Blacksmoke16 I’d like to use minutest.cr, but being a new to crystal, I’m having issues getting it to run … I’ve added it to shard.yml, but on running I’m getting `can't declare class dynamically` … any pointers ?
<FromGitter> <Blacksmoke16> did you run `shards install`
<FromGitter> <baob> yes … also added the require in `spec_helper` and alternatively directly in the spec file too
<FromGitter> <baob> neither worked, same error
<FromGitter> <bew> the error you get is not related to the shard, it means that you can't create a class when you're not in top level
<FromGitter> <bew> you just need to move your class declaration in the toplevel of your file
<FromGitter> <bew> so not in a method or a block
<FromGitter> <girng> @oprypin yes i don't want to talk about it anymore cuz i think i need to keep my mouth shut more. i just take things too personally, i don't know why. i appreciate your understanding and advice. that's actually one of my biggest character flaws online. although, what's weird is, in IRL i'm the total opposite because my nervousness blocks me. but online, I feel invisible.
<oprypin> still beats being invisible IRL
<FromGitter> <baob> @bew the error comes from macro `describe`
<FromGitter> <bew> `describe` is not a macro, it's a method
<FromGitter> <baob> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ba6ae945df5194734fb3d0f]
<oprypin> baob, but it may be caused by code that you passed to it. please share your source code
<oprypin> though i can guess that it looks something like this
<oprypin> `describe "#move_options" do \n class MoveOptionsSpec < Minitest::Spec` which is indeed invalid
<FromGitter> <bew> ah, in the case of minitest `describe` is a macro, my bad
<FromGitter> <baob> my source: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ba6af19e5c2cc56adcb8511]
<FromGitter> <baob> did I do something bad … to break the macro ☝️ ?
<FromGitter> <bew> can you remove the `context` ?
<oprypin> baob, i would guess that you can't have `describe` inside `describe`
<FromGitter> <baob> 😱
<oprypin> but i don't know how minitest works, never looked into it because writing tests that way looks really unattractive to me
<FromGitter> <bew> I bet you have a `require "spec"` inside your `spec_helper.cr`, that is messing everything, making `context` a method, and triggering that error
<FromGitter> <codenoid> hufftt
<FromGitter> <codenoid> i'm always facing problem with JSON::Any + Mongo.cr
<FromGitter> <bew> @baob what's the content of your `spec_helper.cr` file?
<FromGitter> <baob> @bew so it looks like i have a choice between nested describe in `spec` and `let` in minutest/spec … but not both ?
<FromGitter> <baob> spec_helper: ⏎ ⏎ ```# require "spec" ⏎ require "minitest/autorun" ⏎ ⏎ require "../src/q-learning-crystal”``` [https://gitter.im/crystal-lang/crystal?at=5ba6b1595df5194734fb4ec1]
<FromGitter> <bew> yeah, the Spec 'language' in the stdlib and the minitest way of doing things are completely different, and you can't mix them
<oprypin> baob, minitest probably uses `context` instead of nested `describe`
<oprypin> and i was gonna say what @bew said
<FromGitter> <codenoid> how to convert JSON::Any as hash
<oprypin> maan that's really gonna be the #1 question of all time, isnt it
<FromGitter> <baob> Thanks, @bew and @oprypin, guess I'll stick with the nesting i can get in ‘spec’
<FromGitter> <bew> actually there's no `context` keyword in minitest
<oprypin> oh..
<oprypin> codenoid, basically, Crystal really doesn't want you to do that and you should look for alternatives. there are particular cases where this is viable but you need to provide a lot more details
<FromGitter> <codenoid> mongo.cr won't receive JSON::Any
<FromGitter> <codenoid> so i think i must convert it as Hash(String, String)
<oprypin> there we go
<FromGitter> <bew> why do you have a JSON::Any in the first place?
<FromGitter> <codenoid> i got ⏎ ⏎ `env.params.body["name"] # => "{familyName: "fajri", givenName: "muh", middleName: "saleh", formatted: "muh saleh fajri"}"`
<FromGitter> <Blacksmoke16> thats not a hash
<FromGitter> <codenoid> so i do JSON.parse
<oprypin> theeere we go
<FromGitter> <bew> @oprypin please help x)
<FromGitter> <codenoid> 👀
<oprypin> no but it's not even valid json, so i don't get it
<oprypin> codenoid, https://carc.in/#/r/52jw
<FromGitter> <codenoid> <3 <3 <3 <3
<FromGitter> <codenoid> ✨
<FromGitter> <bew> try to avoid JSON::Any like pest
<FromGitter> <bew> and only use it if you have absolutely not other choice
<FromGitter> <codenoid> okay, i update my github description
<FromGitter> <codenoid> I forget easily
<FromGitter> <girng> lol
<FromGitter> <girng> 20 minutes away from switching to ubuntu bungie! rufus usb tool creating bootable iso right now!
<FromGitter> <bajro17> I recommend you manjaro deepin
<FromGitter> <bajro17> I think one of the most beautiful systems and so easy to use
<oprypin> no
<FromGitter> <Sija> @codenoid https://github.com/Sija/any_hash.cr ;)
<oprypin> ok but this is supposed to stop working in the future
<FromGitter> <Sija> @oprypin how come?
<oprypin> standard library never uses recursive aliases and they bring a lot of complexity
<FromGitter> <Sija> well, future is not decided yet so as ling as recursive aliases will work this shard will too
<FromGitter> <Sija> and for the time being they are some solution to parsing json
<oprypin> the belief is that there is always a better alternative
<FromGitter> <Sija> I damn hope so! If you know any please let me know :)
<oprypin> it's on a case by case basis. this particular case was solved, you can see above
<FromGitter> <Sija> which case?
<oprypin> codenoid's question
<FromGitter> <Sija> oh, ok
<FromGitter> <Sija> so how would you solve handling arbitrary json data structures?
wontruefree has quit [Quit: bye]
<FromGitter> <Sija> say I wan’t a hash handling values of all possible json types
<FromGitter> <codenoid> 👀
<oprypin> Sija, that's not a problem specification, that's an implementation detail
<oprypin> standard library provides 3 different approaches, only the class-based one does not apply
<oprypin> json any and pullparser can both work
<FromGitter> <Sija> pullparser imho doesn’t really apply here since it’s a full-blown solution and PITA to use as ad-hoc, while I’m talking about a way to parse it with simple API
<FromGitter> <Sija> `any` would be a candiadate if not the fact it’s even worse than recursive aliases
<oprypin> well it is possibly worse but recursive aliases are not
<oprypin> are not welcome anymore
<FromGitter> <Sija> for the time being they’re part of the language so they’re welcome
<FromGitter> <Sija> it might change with time but without a sensible solution to a problems like these I’m gonna vote to keep ‘em
<oprypin> problems like which
<FromGitter> <Sija> like the one we’ve been discussing
<FromGitter> <codenoid> ummm, is crystal have library to combine image sequence into video ? ⏎ i can't find that in crystalshards.xyz
<FromGitter> <codenoid> https://en.wikipedia.org/wiki/Remote_access_trojan ⏎ my rat live preview come from "screenshot", and i have a bunch of images, and i want to convert it as video
<FromGitter> <codenoid> reddit blocked in my country
<FromGitter> <vladfaust> There are many things blocked in my country as well
<FromGitter> <vladfaust> I use VPN for that
<FromGitter> <codenoid> yeah, but i can connect to local network when using vpn, ⏎ and proxy addons / ext is a bad thing, my browser many times crash because of that
<FromGitter> <codenoid> can't
<FromGitter> <vladfaust> I'm sorry for that then
<FromGitter> <codenoid> nvm i'll use another pc
<FromGitter> <codenoid> crystal need more multimedia library
wontruefree has joined #crystal-lang
wontruef_ has joined #crystal-lang
wontruefree has quit [Ping timeout: 252 seconds]
wontruef_ has quit [Quit: bye]
<FromGitter> <bew> sometimes I hate when Crystal is not flexible enough ><
<FromGitter> <bew> hm not "flexible" but like: the compiler is written in a way where each case must be handled individually, instead of having a more generic approach (and I think this is why some advanced stuff like generics are broken)
<FromGitter> <girng> @codenoid what country?