Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:43
    straight-shoota labeled #11351
  • 18:43
    straight-shoota labeled #11351
  • 18:07
    FnControlOption opened #11351
  • 13:26
    HertzDevil edited #11350
  • 12:16
    HertzDevil labeled #11350
  • 12:16
    HertzDevil labeled #11350
  • 12:16
    HertzDevil labeled #11350
  • 12:16
    HertzDevil opened #11350
  • 09:52
    HertzDevil synchronize #11298
  • 09:49
    HertzDevil synchronize #11298
  • 09:37
    HertzDevil synchronize #11298
  • 09:30
    HertzDevil synchronize #11298
  • 09:27
    HertzDevil synchronize #11298
  • 08:50
    HertzDevil edited #11348
  • 08:34
    HertzDevil edited #11348
  • 08:33
    HertzDevil labeled #11349
  • 08:33
    HertzDevil opened #11349
  • 07:35
    HertzDevil opened #11348
  • 07:35
    HertzDevil labeled #11348
  • 07:35
    HertzDevil labeled #11348
From IRC (bridge bot)
@FromIRC
<raz> hash*
<hightower2> Seems a couple presentations are not among the recordings.. e.g. Ary's or btate's.. What's up with that?
<hightower2> (from the crystal conf, of course)
<hightower2> ah could be in main track
mfiano
@mjfiano:matrix.org
[m]
I have a few types which all include some partial types. These modules are never intended to be seen be the user, such as in generated documentation pages with crystal doc, but I can't exactly make them private either if I want to include them in other modules/types, and protected doesn't seem to work on modules, so I'm not really sure if Crystal has a solution for me...
The mixins are purely for DRY/maintenance reasons
George Dietrich
@Blacksmoke16
# :nodoc:
mfiano
@mjfiano:matrix.org
[m]
Any ideas?
Oh hmm, that might be what I'm looking for :)
mfiano
@mjfiano:matrix.org
[m]
That does work, however, perhaps it's me being picky but it'd be nice if the types that include a :nodoc: module didn't generate docs with references to the hidden module, as it currently does with "Instance methods inherited from module..."
George Dietrich
@Blacksmoke16
you'd probably need to have public methods in each type that delegate to the module
otherwise the docs are correct, those methods dont actually live in the type, they come from that module
From IRC (bridge bot)
@FromIRC
<straight-shoota> I think the docs generator is not handling things like this very nicely
<straight-shoota> If you want this mixin to be completely invisible, maybe you could just use a macro that generates these methods.
mfiano
@mjfiano:matrix.org
[m]
I see. This is not a big deal really, and delegates/macro would be more trouble than its worth.
Thanks for the pointers. I'm happy enough with :nodoc:
George Dietrich
@Blacksmoke16
@straight-shoota related to crystal-lang/crystal#10977, so is the current output actually correct?
From IRC (bridge bot)
@FromIRC
<straight-shoota> Yes, the behaviour is correct and as expected. The documentation is just wrong.
George Dietrich
@Blacksmoke16
hm, whats the reasoning when not using a buffered channel that the output is
Before send 1
Before send 2
1
2
Before send 3
After send
3
shouldnt the first send cause the receive to print the value?
https://play.crystal-lang.org/#/r/blx6 which is how it worked before
From IRC (bridge bot)
@FromIRC
<straight-shoota> Channel#send doesn't immediately yield to a waiting receiver, it just enqueues it (so it get's resumed when the scheduler reschedules)
George Dietrich
@Blacksmoke16
i guess to me it seems more like a regression as it used to work one way and now works a diff way
From IRC (bridge bot)
@FromIRC
<straight-shoota> So on send(1), the receiving fiber is enqueued, on send(2), there's no waiting receiver and no queue, so the channel triggers a reschedule.
George Dietrich
@Blacksmoke16
when the thing that changed it was MT, which maybe its a byproduct of supporting MT versus a regression
From IRC (bridge bot)
@FromIRC
<straight-shoota> No, I think it's a fix really. The previous behaviour was not correct. At least not what you would expect from the specifics of a channel.
George Dietrich
@Blacksmoke16
hmm fair enough
mfiano
@mjfiano:matrix.org
[m]
Do I have to create 2 different partial types if the intended behavior is to mixin a set of instance methods and a set of class methods?
George Dietrich
@Blacksmoke16
i usually define a ClassMethods module within the one partial type, then add a like macro inherited; extend ClassMethods; end;
mfiano
@mjfiano:matrix.org
[m]
I can't seem to get that to work. Maybe I'm doing it wrong...
George Dietrich
@Blacksmoke16
module Foo
  module ClassMethods
    def class_method
      2
    end
  end

  macro inherited
    extend ClassMethods
  end

  def instance_method
    1
  end
end

class Bar
  include Foo
end

Bar.new.instance_method # => 1
B.class_method # => 2
sorry
macro included :see_no_evil:
mfiano
@mjfiano:matrix.org
[m]
Still trying unsuccessfully. My project is too spread out and unfinalized to publish it yet. I may have to try to isolate the problem on carc.in or smth :/
George Dietrich
@Blacksmoke16
gl
mfiano
@mjfiano:matrix.org
[m]
works fine as separate modules tho
where is included documented?
mfiano
@mjfiano:matrix.org
[m]
Ah...I was doing it correctly, but I believe I ran into a compiler bug I should file, due to my own mistake though. I have a A::B module that does include A (don't ask why), and this works until you add an included hook. Probably gives up fully resolving due to cyclic graph
mfiano
@mjfiano:matrix.org
[m]
Ah the issue is not as bad as that actually, but still unsure how to solve it.
One class method in ClassMethods has a default argument value specified to be a constant. This constant id is guaranteed to exist in all types that include Foo, but with a different value for each type.
and the ultimate problem when getting rid of red herrings, is that this constant cannot be resolved at parse time, since it depends on the type that includes it
Interesting problem
mfiano
@mjfiano:matrix.org
[m]
On another note, I'm curious if any other languages have something like the namespaces/partial type duality, as it is new to me and I think it is pretty clever. Does Ruby do this, was this feature inspired by other similar concepts, or is this unique to Crystal?
George Dietrich
@Blacksmoke16
it's basically copied from ruby
mfiano
@mjfiano:matrix.org
[m]
I see. It is a nice idea.
mfiano
@mjfiano:matrix.org
[m]

"Note that most search and filter methods traverse an Enumerable eagerly,
producing an Array as the result. For a lazy alternative refer to
the Iterator and Iterable modules."

Does this apply to #all?, and if so, what is an efficient way to do it if I have Iterable?

George Dietrich
@Blacksmoke16
all? returns a bool