On Friday, 9 November 2018 at 09:17:27 UTC, Alex wrote:
Is it this what you are looking for?
https://dlang.org/phobos/std_traits.html#Parameters
I've been looking over std.traits all day yesterday, how could
I've missed that?
I'm so glad there are people in this forum that want to help out
othe
On Friday, 9 November 2018 at 09:13:56 UTC, Sjoerd Nijboer wrote:
On Thursday, 8 November 2018 at 21:16:32 UTC, Sjoerd Nijboer
wrote:
I tried tom make a lazyscoped!T but I'm stuck at creating a
constructor and determining the arguments from the Type.
Unfortunately I can't find a way in D to ge
On Thursday, 8 November 2018 at 21:16:32 UTC, Sjoerd Nijboer
wrote:
I tried tom make a lazyscoped!T but I'm stuck at creating a
constructor and determining the arguments from the Type.
Unfortunately I can't find a way in D to get a list of arguments
at compile time for a given function. Is thi
On Thursday, 8 November 2018 at 16:31:26 UTC, Neia Neutuladh
wrote:
I believe what you need to do is pass a factory function into
the constructor. This is a bit awkward.
Yep, but I want a "nice and descriptive syntax" for it.
Anyway, here's some code to make it work. It's kind of ugly.
---
i
On Thu, 08 Nov 2018 11:04:19 +, Sjoerd Nijboer wrote:
> I'm trying to invert the dependency from the classes `Bar -> Foo` to
> `Foo -> IFoo <- Bar` at compile time.
>
> I do want `Foo's` to be embedded into `Bar`
These goals are a *little* at odds with each other; having a scoped!Foo
puts si
On Thu, 08 Nov 2018 12:45:57 +, Alex wrote:
> Hmm... not sure, if I got your idea... Do you think about something like
> this?
The point is dependency inversion. The class shouldn't need to know how to
build its dependencies; it should leave that to other code. The fact that
you can use the
On Thursday, 8 November 2018 at 15:11:16 UTC, Sjoerd Nijboer
wrote:
Except if you want to pass a parameter to TFoo it'll become a
mess.
And I expecially don't want it to become messy.
I thought of this case... But passing the argument to TFoo
directly while constructing Bar is messier, I thin
On Thursday, 8 November 2018 at 12:45:57 UTC, Alex wrote:
Hmm... not sure, if I got your idea... Do you think about
something like this?
**snip**
class Bar(TFoo) if(is(TFoo : IFoo))
{
typeof(scoped!TFoo()) _foo;
this()
{
_foo = scoped!TFoo();
On Thursday, 8 November 2018 at 11:04:19 UTC, Sjoerd Nijboer
wrote:
I'm trying to invert the dependency from the classes `Bar ->
Foo` to `Foo -> IFoo <- Bar` at compile time.
I do want `Foo's` to be embedded into `Bar`
So silly me tried something like this:
[...]
So how can I delay the constr
I'm trying to invert the dependency from the classes `Bar -> Foo`
to `Foo -> IFoo <- Bar` at compile time.
I do want `Foo's` to be embedded into `Bar`
So silly me tried something like this:
module main;
```import std.stdio;
import std.typecons;
void main()
{
auto bar = new Bar!(scoped
10 matches
Mail list logo