<FromGitter>
<Blacksmoke16> i would have thought this would only instantiate the store once, and the object IDs of each `container` call be the same since the fiber is the same
<FromGitter>
<Blacksmoke16> nvm, fiber ID is the same, but i still would have thought the others would be as well
<FromGitter>
<kimvex> @Blacksmoke16 so imagine. I am developing an app and generating one thread per core, but that causes me problems with the mysql database connector. I didn't know why the problem was happening until I realized it could be because of the threads. So I wanted to know if with the last update of the language I automatically used the nuclei and no longer create the threads for me.
<FromGitter>
<Blacksmoke16> its been an opt in feature for a while
<FromGitter>
<Blacksmoke16> so unless you been building with `-Dpreview_mt` then you have always been in single threaded mode
<FromGitter>
<kimvex> > so unless you been building with `-Dpreview_mt` then you have always been in single threaded mode ⏎ ⏎ oh
<FromGitter>
<codenoid> folks, stay home
Dreamer3 has quit [Quit: Leaving...]
<FromGitter>
<watzon> No
dostoyevsky has quit [Ping timeout: 265 seconds]
dostoyevsky has joined #crystal-lang
ur5us has quit [Ping timeout: 244 seconds]
<FromGitter>
<grkek> DENIED
<FromGitter>
<neutrinog> how can I get the full namespace of a class? eg. `class.name` returns just the class name obviously. How can I also get `Name::Space::MyClass`?
<FromGitter>
<galvertez> `{{@type}}` should work
<FromGitter>
<neutrinog> oops. name does return all of that. Disregard. :P
alexherbo2 has joined #crystal-lang
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> @lbarasti you are an elogant speaker, and good at explaining things. should do more vids!
Seich has quit [Quit: Gone fishing.]
<FromGitter>
<lbarasti> @ImAHopelessDev_gitlab ❤️
<raz>
+1 that video is awesome! (just had a peek and expected a quick rimer, but this is more like a full blown tutorial)
<raz>
that could/should be added right to the crystal docs imho
<FromGitter>
<3n-k1> oh nice, thanks for letting me know
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter>
<fenicks> Hi everyone, ⏎ Do you know the right idiom in crystal to make a class not copyable? ⏎ I read about Reference Class and see a `dup` method but not the `clone` method, If I add a `raise` in an overriden `dup` method is it Ok? ⏎ ⏎ Thanks. [https://gitter.im/crystal-lang/crystal?at=5ea6c2d894ac2758e30f2d75]
<FromGitter>
<straight-shoota> @fenicks What is your goal with this?
<FromGitter>
<straight-shoota> @nodefourtytwo_gitlab `UNIXSocket` is the client socket. It doesn't create a new socket, it connects to an existing one. `UNIXServer` is the server socket.
<FromGitter>
<fenicks> @straight-shoota I'm planning to implement something like Golang WaitGroup and learning the best way to do that in Crystal.
<FromGitter>
<straight-shoota> But why do you want to forbid cloning an instance?
<FromGitter>
<straight-shoota> btw. have you seen #6468?
<yxhuvud>
I suppose if you have a nursery with internal state you wouldn't want it dupped. Not certain how big of a problem it is in practice though.
<FromGitter>
<fenicks> @straight-shoota To be sure that a WaitGroupe instance is uniq and protect some unsafe stuff. But to be honest I'm not sure if it's needed in Crystal.
<FromGitter>
<fenicks> @straight-shoota I'll read it thanks.
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter>
<kingsleyh> afternoon - I have a thing which fires up many Fibers and they all go off and do their thing given some starting info - and they report back once their thing is done with the fruits of their labour. Sometimes while they are all off on their adventures the thing I asked them to do is no longer correct and now I need them to do almost the same thing but with a different bit of starting information. So I just
<FromGitter>
... fire up a bunch of new Fibers with the new tasks - however the previous guys are so excited by their research that they insist on wanting to tell me all about it which continues until they are all finished - I don't care about them anymore but i just don't know how to tell them. I want to let them down gently so my new guys ... [https://gitter.im/crystal-lang/crystal?at=5ea6f1a5568e5258e489c28c]
<FromGitter>
<kingsleyh> I guess I could just try to ignore them?
<FromGitter>
<Blacksmoke16> probably, afaik there isnt a way to "cancel" a queued/running fiber
<FromGitter>
<kingsleyh> I could do something like `jobs.each{|job| job.ignore }` and then use that variable inside the job to stop it from reporting back it's info
<FromGitter>
<kingsleyh> however I'm not sure the best way to do that
<FromGitter>
<Blacksmoke16> have the channels return some struct with the data and context about that job, that you can then use when its received to determine what to do with it?
<FromGitter>
<kingsleyh> is it bad to just close the channels for each job?
<FromGitter>
<kingsleyh> the Fibers will still try to run I guess but they will find the channels are closed and so throw exceptions
<FromGitter>
<Blacksmoke16> are those other ivars internal only?
<FromGitter>
<Blacksmoke16> also whats with `name.attack_power` etc? isnt `name` a string?
<FromGitter>
<Blacksmoke16> id consider using an enum for the type
<FromGitter>
<Blacksmoke16> in regards to printing the stats, one option would be possibly override `.to_s(io : IO)`
<FromGitter>
<Blacksmoke16> depends on how you want it to be used
<FromGitter>
<oliviahandoko> inside the intialization is where I want all my pokemon characters to all have but current_hp and attack power is based on the specific pokemon I am using
<FromGitter>
<Blacksmoke16> part of me thinks having a separate type for each pokemon would make sense, but that would be quite a lot of types...
<FromGitter>
<Blacksmoke16> then you could have an abstract type to do common stuff and some protected methods to define stats of that particular one
<FromGitter>
<oliviahandoko> gotcha! Thank you so much. I will see what I can do from here
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<Blacksmoke16> improvements/abstractions could deff be an option. however depends on the end goal of this if they would be worth it/which ones would make sense
<FromGitter>
<oliviahandoko> hmmm.. if I create another class that inherits the Pokemon class, how do I call that class. Like if class PokemonOpponent < Pokemon
<FromGitter>
<Blacksmoke16> call that class? meaning like within the constructor?
<hightower2>
Hey in regex, how would I specify both the atomic group and group name? I.e. I need to specify both (?> and (?<grpname>
Nekka has quit [Ping timeout: 240 seconds]
Vexatos has quit [*.net *.split]
Xeago has quit [*.net *.split]
Nekka has joined #crystal-lang
Vexatos has joined #crystal-lang
Xeago has joined #crystal-lang
<FromGitter>
<Grabli66> Hi! I am trying to build static binary with docker crystal:0.34.0-alpine, but i am getting error undefined reference to `lzma_code'. What i am doing wrong?
<FromGitter>
<j8r> Use rather `crystallang/crystal:0.34.0-alpine-build`
<FromGitter>
<Blacksmoke16> shouldnt need that unless you're building the compiler
<FromGitter>
<j8r> yeah, but it is convenient there are libraries
<FromGitter>
<kingsleyh> @didactic-drunk the problem is that after I spawned all the Fibers - I get an update - and I no longer care about those fibers - they are now in the way and I want to issue a new set
<FromGitter>
<kingsleyh> but it's not possible to kill a Fiber - so they just continue on - which means they get in the way
Deuns has joined #crystal-lang
<Deuns>
hello
<FromGitter>
<Blacksmoke16> o/\
<FromGitter>
<didactic-drunk> @kingsleyh Does each fiber have a possible break out point? Are they looping?
<FromGitter>
<didactic-drunk> No, it was your original example. Am multitasking an losing track.
<FromGitter>
<kingsleyh> the rescue was not rescuing much though - only EOFError
<FromGitter>
<kingsleyh> if I close the channel then I get spammed with: Unhandled exception in spawn: Channel is closed (Channel::ClosedError)
<FromGitter>
<kingsleyh> and the fibers continue going
<FromGitter>
<kingsleyh> just getting spammed now
<FromGitter>
<oliviahandoko> @Blacksmoke16 I am so confused. I created classes for individual pokemons but I am unsure how to make them "battle" eachother. In the python program, a friend and I made it looks like this
<FromGitter>
<kinxer> Yeah... I realized immediately that it sounded like a dumb thing to say. :P
<oprypin>
oliviahandoko, i like Python and Crystal and games. btw is this a game to be played only in a terminal (text)?
<FromGitter>
<kinxer> Anyway, some part of me just took it as a given that the `def initialize(@something)` was *special*.
<FromGitter>
<kinxer> 1) ~~*special*~~
<FromGitter>
<kinxer> ... Not what I wanted.
<FromGitter>
<kinxer> `~~*special*~~`
<oprypin>
kinxer, no nothing dumb, i'm just talking about placeholder words in https://carc.in/#/r/8yua
<FromGitter>
<kinxer> Oh, right. Yeah, I decided a few months ago that I'd rather just use words I enjoy typing and reading instead of always just doing `class A...`.
<FromGitter>
<kinxer> I do tend to end up using words starting with A, though.
<oprypin>
are there any nightly Crystal builds for mac?
<FromGitter>
<Blacksmoke16> @oliviahandoko is there a specific error something you're running into?
<FromGitter>
<kinxer> @oprypin Looking back at your message, I see that I misread "choice words" as "word choices"... Anyway, I appreciate your appreciation of the words I used.
<oprypin>
:> sorry that it was unclear
<FromGitter>
<kinxer> No worries. It was an error on the reading side, not the writing side. :P
<oprypin>
straight-shoota, ech i started to write something semi-angry, as i know for sure that i've had that use case so many times before and i'm passionate about it, but in the end maybe it isnt essential and maybe you're right
<oprypin>
still disagree with the auto-fallback method though. so what if you happened to run into many cases where they want the fallback. still write it out explicitly, it's better to see that, otherwise the reader has to look that up
<straight-shoota>
Yeah, I can relate to both your points
<straight-shoota>
I understand the use cases for `is_path_under_base` an I'm pretty sure we should have that as a feature. But it requires different considerations than `relative_to`, so it probably needs a custom implementation.
<straight-shoota>
So far I haven't run into a single case that didn't want to fall back to the non-relativized path. And that makes sense considering that this feature is to be meant to shorten paths to make them nice for display.
<straight-shoota>
It's just a convenience feature. If the path can't be made shorter, you use the explicit one.
<FromGitter>
<didactic-drunk> How do I disable exhaustive case?
<FromGitter>
<watzon> I don't believe you can, but you can just throw an `else` in there
_ht has quit [Quit: _ht]
<FromGitter>
<Blacksmoke16> im just going to ignore him now
<FromGitter>
<Blacksmoke16> is like girng but less friendly :P
<jhass>
hehe, I decided to start hiding their posts or isolating them into new topics you can just ignore ;)
<FromGitter>
<watzon> What'd I miss? Lol
<FromGitter>
<Blacksmoke16> guy on the forums whos mad because overflows raise an exception versus just defaulting the the type's max value
<FromGitter>
<Blacksmoke16> to the*
<jhass>
their just generally mad to be honest :P
<FromGitter>
<watzon> Lmao, time to go check the forum I guess
<straight-shoota>
I understand the general attitude is not welcoming.
<FromGitter>
<didactic-drunk> @watzon Exhaustive case fails with many shards. It's too much work for me to fix every one.
<FromGitter>
<watzon> Ahh, yeah afaik there's no way to turn it off
Seich has joined #crystal-lang
<jhass>
straight-shoota: tone is clearly off and nothing productive added
<jhass>
I mean just look at the further responses in the thread now....
<straight-shoota>
Yeah, the general conduct is not acceptable
<straight-shoota>
But the individual comment just states the rightful opinion on the topic
<oprypin>
wait is that IRC i see
<straight-shoota>
It's certainly not ideal at this point. But if the comment was from someone else, would you have flagged it?
<jhass>
straight-shoota: I disagree. That opinion is completely irrelevant to the discussion.
<jhass>
in that tone? yes
<jhass>
in a more civil tone I would be more undecided
<straight-shoota>
I don't think the opinion is generally irrelevant. If someone asks how to shoot themselves in the foot and I'm convinced that's not a good idea I'd definitely point that out.
<FromGitter>
<j8r> jhass @Blacksmoke16 he has an emotional overflow 😂
<straight-shoota>
But I agree that the way it's presented doesn't help
<FromGitter>
<j8r> first time I see straight-shoota on IRC
<jhass>
straight-shoota: what's the benefit? There's zero content in there. There's no "why" this is a bad idea. There's no alternative/easier solution hinted at. There's zero value.
<straight-shoota>
It could spark a deeper discussion ¯\_(**)_/¯
<FromGitter>
<watzon> Seems like his main concern is that you can't do what he wants as a one liner
<straight-shoota>
@j8r I've been on IRC before occassionally
<FromGitter>
<watzon> Which is idiotic. It's pretty easy to catch the overflow exception and set the value to the max manually.
<straight-shoota>
Now it's because my ISP is having connectivity issues since a few hours and at some point Gitter stopped working ^^
<straight-shoota>
Maybe their interchange is infected with covid-19 :D
<FromGitter>
<watzon> I've seen so many complete morons on Telegram that actually think this way, I have a hard time seeing someone like that as anything but the same
<straight-shoota>
great to see the reactions from the community, though. Everyone's being nice about it
<FromGitter>
<watzon> Hahaha DnD reference. I like.
<FromGitter>
<didactic-drunk> Often considered brainless.
<FromGitter>
<watzon> Brainless and toxic
<FromGitter>
<watzon> follows
<FromGitter>
<didactic-drunk> Wait, can I be mean? Shit. I missed an opportunity for free therapy.
<FromGitter>
<watzon> I want to know who pissed in their corn flakes
<FromGitter>
<watzon> Every thing you say, doesn't matter what it is, they just pick out something to be mad about rather than listening
<FromGitter>
<watzon> It's like talking to a toddler
ur5us has joined #crystal-lang
<FromGitter>
<Blacksmoke16> made it so you dont have to include a module anymore, and also auto resolves dependencies
<jhass>
okay guys, please remember this is a public and logged space. please move any discussion persons to DMs, thanks :)
<FromGitter>
<Blacksmoke16> tried to*
<FromGitter>
<watzon> Very cool @Blacksmoke16 😄
<FromGitter>
<Blacksmoke16> *magic*
<FromGitter>
<watzon> I'm going back to working on an ORM I had started on months ago
<FromGitter>
<kinxer> I just read through that overflow thread... Oof. On a side note, I wish I'd read through bdcardiff's solution before posting myself; an LLVM builtin solution is almost certainly going to work better than a pure Crystal implementation.
<FromGitter>
<watzon> With module based models rather than abstract classes
<FromGitter>
<Blacksmoke16> a repo approach to decouple the model and the logic to query/save would be nice
<FromGitter>
<watzon> @kinxer at the very least it will likely be faster, but they don't seem happy with any of the answers
<FromGitter>
<Blacksmoke16> but gets tricky w/o reflection as wouldnt have a way to set the auto `id`
<straight-shoota>
watzon, Hmm there are already so many ORMs that it's hard to choose. Please make sure yours stands out =)
<FromGitter>
<kinxer> Yeah... I think the way I'd want to handle it from a ui standpoint is with generics, which I think would satisfy his (?) desire to use `+` with impunity.
<FromGitter>
<Blacksmoke16> make it work with annotations
<FromGitter>
<watzon> I'm working on it haha. Unfortunately none of the current ones fit my use case. I just want creating models to be as easy as `JSON::Serializable` is.
<FromGitter>
<watzon> @Blacksmoke16 that's the idea
<FromGitter>
<Blacksmoke16> granite works like that fwiw
<FromGitter>
<Blacksmoke16> `column` macro just defines an ivar with an annotation
<FromGitter>
<Blacksmoke16> are some open issues/PRs that would allow for a bit more but :shrug:
<FromGitter>
<Blacksmoke16> yea similar to granite
<FromGitter>
<Blacksmoke16> you have that working, or what you want the end result to be?
<FromGitter>
<watzon> That's what I want the end result to be. It is very similar to granite, but for the module based approach. Tbh if granite just used modules I could probably make it work for my use case.
<FromGitter>
<watzon> I tried implementing the change myself, but there's a lot to work around
<straight-shoota>
watzon, I suppose the difficult part is keeping track of changes to the properties
<FromGitter>
<Blacksmoke16> `@[Gravity::HasMany(Chat, lazy: true)]` ill be curious if you get it to work
<FromGitter>
<Blacksmoke16> `user = User.new(id: 1234, first_name: "John", last_name: "Doe")` also may i suggest *not* supporting magic initializers behind the scenes
<FromGitter>
<watzon> Yeah that's gonna be one of the hard parts
<FromGitter>
<Blacksmoke16> having it work well with serialization is also tricky
<FromGitter>
<Blacksmoke16> like supporting (de)serializing the models directly
<FromGitter>
<watzon> Hmm yeah I'll have to think about that. I like having `.new` and `.create` methods built in that automatically take the expected values.
<FromGitter>
<Blacksmoke16> just gets tricky on how to handle edge cases like preventing people from manually setting auto int PKs
<FromGitter>
<Blacksmoke16> but yea, keep me posted. last i remember some of it wont be easy w/o nilable properties
<FromGitter>
<Blacksmoke16> `{{ table ? table[:name] : @type.name.underscore }}` would use the full namespace of the type, prob with the `::` as a heads up
<FromGitter>
<watzon> Didn't think about that
gangstacat has quit [Quit: Ĝis!]
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> @straight-shoota any word on the bdwgc release?
<straight-shoota>
I have no idea. Don't even recall where it was semi-officially mentioned
<straight-shoota>
But I know I came across it again since I told you about it, so I didn't make it up.
<straight-shoota>
At least it's proven to me =)
<FromGitter>
<Blacksmoke16> :sad: okay
Nekka has quit [Ping timeout: 240 seconds]
straight-shoota has quit [Ping timeout: 240 seconds]
straight-shoota has joined #crystal-lang
<straight-shoota>
Maybe it's better to build our own then...
<straight-shoota>
Feel free to post a PR^^
Nekka has joined #crystal-lang
<straight-shoota>
watzon, don't feed... =)
<FromGitter>
<watzon> I'm done lol
<FromGitter>
<Blacksmoke16> i might give it a try, imagine just need to copy whats in the linux/Dockerfile?
<FromGitter>
<Blacksmoke16> be nice to be able to use MT in that image
<FromGitter>
<didactic-drunk> How do I control the number of threads? Is there an environment variable?
<FromGitter>
<Blacksmoke16> `CRYSTAL_WORKERS`
<FromGitter>
<kinxer> You can't overload the assignment operator, right?
<jhass>
not for locals
<jhass>
or any kind of variables. for properties on objects yes
<jhass>
that's how setter/property works. Just defining def foo=(value) style methods which can be called like ob.foo = value. So technically there's no assignment operator in there, it's just parsed as a call. But it sure looks like one
Nekka has quit [Ping timeout: 264 seconds]
<FromGitter>
<watzon> @Blacksmoke16 any idea how I'd get the generic for of `@type`? So the value of `T` in `struct Foo(T)`
<FromGitter>
<Blacksmoke16> or `@type.type_vars` or something like that
<FromGitter>
<watzon> I remember T not working in macros, but I could try again
<FromGitter>
<Blacksmoke16> has to be within a method iirc
Nekka has joined #crystal-lang
straight-shoota has quit [Ping timeout: 264 seconds]
straight-shoota has joined #crystal-lang
<FromGitter>
<kinxer> Another question: is there any way to test compile-time behavior? In particular, I'd love to specify that trying a certain thing raises a compile-time error.
<FromGitter>
<watzon> @Blacksmoke16 In keeping track of changes to a record, I'm going to set a `modified` flag on a field when its value gets set. Do you think I should still set the flag if the value was set, but not actually changed? (Meaning they set it to the same thing it already was)
<FromGitter>
<watzon> My thought it yes, just in case the value was modified outside the scope of the ORM
<straight-shoota>
Blacksmoke16, yeah it's basically already in the Dockerfile for the linux build