-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Proposal]: [call local static functions in base constructor] #3980
Copy link
Copy link
Closed
Labels
Needs Approved SpecificationThis issue needs an LDM-approved specificationThis issue needs an LDM-approved specificationProposalProposal champion
Milestone
Description
call local static functions in base constructor
- Proposed
- Prototype: Not Started
- Implementation: Not Started
- Specification: Not Started
Summary
Today to calculate parameters to be sent from derived class constructor to base constructor one has to define additional static method in derived class. It would be nice to use local static function instead.
Motivation
Not to litter class members scope with functions that should be encapsulated as local ones.
Example
class A
{
public A(int x)
{
...
}
}
class B:A {
public B(int z):base(Local(z))
{
static int Local(int h)
{
...
}
}
}
Drawbacks
Alternatives
Unresolved questions
Design meetings
https://github.com/dotnet/csharplang/blob/master/meetings/2020/LDM-2020-10-26.md#static-local-functions-in-base-calls
https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-09-28.md#ungrouped
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs Approved SpecificationThis issue needs an LDM-approved specificationThis issue needs an LDM-approved specificationProposalProposal champion