Thread overview
"final" as function parameter attribute?
Nov 21, 2015
Johan Engelen
Nov 22, 2015
Jonathan M Davis
Nov 22, 2015
Johan Engelen
November 21, 2015
On http://dlang.org/function.html, I read that "final" is a valid attribute/storage class for function parameters:

InOutX:
    auto
    TypeCtor
    final  <-- ??
    in
    lazy
    out
    ref
    scope

This looks like a documentation error, but perhaps it's not. I hope someone can explain what it means, or confirm that it is an error. If it really is a valid storage class for parameters, please help document it here: http://dlang.org/function.html#parameters

Thanks!

-Johan

November 22, 2015
On Saturday, November 21, 2015 15:14:31 Johan Engelen via Digitalmars-d-learn wrote:
> On http://dlang.org/function.html, I read that "final" is a valid attribute/storage class for function parameters:
>
> InOutX:
>      auto
>      TypeCtor
>      final  <-- ??
>      in
>      lazy
>      out
>      ref
>      scope
>
> This looks like a documentation error, but perhaps it's not. I hope someone can explain what it means, or confirm that it is an error. If it really is a valid storage class for parameters, please help document it here: http://dlang.org/function.html#parameters
>
> Thanks!

Neither auto nor final is valid on a function parameter, so either the grammar is wrong, or InOutX is not used for function parameters. But looking at that page, I'd have to spend a fair bit of time working through it to figure out what it's actually saying.

The bug for tracking all known grammar issues is here:

https://issues.dlang.org/show_bug.cgi?id=10233

And Brian Schott (who's trying to get all of the grammar issues fixed) has
his own version here

https://github.com/Hackerpilot/DGrammar

- Jonathan M Davis

November 22, 2015
On Sunday, 22 November 2015 at 00:21:29 UTC, Jonathan M Davis wrote:
>
> Neither auto nor final is valid on a function parameter, so either the grammar is wrong, or InOutX is not used for function parameters. But looking at that page, I'd have to spend a fair bit of time working through it to figure out what it's actually saying.

Start from "Parameters:" and instantiate subitems until you reach InOutX :-)
InOutX is definitely (and only) used for function parameters.

> The bug for tracking all known grammar issues is here:
>
> https://issues.dlang.org/show_bug.cgi?id=10233

Great, thanks!

> And Brian Schott (who's trying to get all of the grammar issues fixed) has his own version here
>
> https://github.com/Hackerpilot/DGrammar

Thanks for the link. It is also wrong in his grammar: parameterAttribute contains both "final" and "auto".