Re: Generic methods are deprecated?

2020-06-08 Thread bpr
If you look at related languages, like C++, where member function templates cannot be declared virtual, and Rust, where the object safety rules forbid traits with generic parameters from being made into trait objects, you'll see that this is a common problem, and that the near term solution is

Re: Generic methods are deprecated?

2020-06-07 Thread Chris3606
Sorry to necro... but... Is there a replacement for generic methods as nim currently stands? I'm currently using a tuple-of-procs approach but it would be nice to have a better alternative.

Re: Generic methods are deprecated?

2019-06-15 Thread Araq
Well yes, the problem is that we don't attach methods to a type so when you write `G[T]` we cannot instantiate every method that "belongs to" `G`. And methods we don't generate cannot participate in the dispatching process. Now that I've written that, maybe we can instantiate generics during

Re: Generic methods are deprecated?

2019-06-15 Thread bluenote
> AFAIK removal of generic methods is so that under-the-hood we can switch the > methods implementation to a vtable But shouldn't a vtable be able to handle generics that are attached to the base just fine? For instance, the `Test` class has a vtable with a single slot for `call`. An

Re: Generic methods are deprecated?

2019-06-12 Thread mratsim
It's delayed not cancelled.

Re: Generic methods are deprecated?

2019-06-11 Thread andrea
> concepts were deemed to experimental yet to build another key feature on top Uh that's sad, it would have been nice to have static and runtime polymorphism coexist nicely within the same mechanism

Re: Generic methods are deprecated?

2019-06-11 Thread mratsim
AFAIK removal of generic methods is so that under-the-hood we can switch the methods implementation to a vtable (compared to the current dispatch tree) but we do need a blog post explaining the way forward, i.e. there will be a replacement. Regarding generic macros, you cannot use `macro

Re: Generic methods are deprecated?

2019-06-10 Thread boia01
I'm also a happy user of generic methods. I had originally started with tuples-of-procs and then moved code over to method. In theory, yes, macros could give us methods. However, after looking at the various macro-powered-methods projects, I don't think any of them support generics. I'm not

Re: Generic methods are deprecated?

2019-06-09 Thread Araq
> All my relevant projects rely on generics with methods. Well that's bad, we need to find a solution. In my mind I `method` is better replaced altogether with a `class` macro that produces a traditional VTable.

Re: Generic methods are deprecated?

2019-06-09 Thread kaushalmodi
Only generic **methods** are deprecated. Generic procs (types, etc.) are not affected by this.

Re: Generic methods are deprecated?

2019-06-09 Thread kaushalmodi
Yes, generic methods are deprecated: [https://github.com/nim-lang/Nim/blob/devel/changelogs/changelog_0_20_0.md#changes-affecting-backwards-compatibility](https://github.com/nim-lang/Nim/blob/devel/changelogs/changelog_0_20_0.md#changes-affecting-backwards-compatibility)

Re: Generic methods are deprecated?

2019-06-09 Thread dduvall
I haven't upgraded yet (will do after I ship this next project), Have you noticed this warning with Generic Procedures?

Generic methods are deprecated?

2019-06-09 Thread bluenote
I just noticed that something as simple as type Test[T] = ref object of RootObj method call[T](t: Test[T]) {.base.} = discard Run now generates a warning `generic methods are deprecated`. All my relevant projects rely on generics with methods