On Sunday, 11 September 2022 at 00:04:55 UTC, Adam D Ruppe wrote:
On Saturday, 10 September 2022 at 23:37:30 UTC, Kyle Ingraham wrote:
How can I write a type that is strict for the first two parameters but tolerant of any other parameter following those?

That's not a type per se, but you can assign wrapper at the assignment thing.

Like

your_delegate = (a,b) => func_with_three_args(a, b, "some default");

that kind of thing. if you have a delegate in an object, you can use a property setter to accept more things and wrap it like that.

My problem is that I would like to store a reference to that delegate in a struct for later use:

```d
struct MyStruct
{
    MyDelegate myDelegate;
}
```

I can't use default parameters because I want to be able to call the delegate with arguments extracted from a URL path at runtime. I'm mucking about with a custom router for vibe-d and trying to setup the ability for handlers to have different parameter signatures.

Reply via email to