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]
<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
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>
<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>
<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>
<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>
<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>
<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> 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> 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>
<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>
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
<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
<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> 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>
<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
<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> 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)