[Issue 2753] Cannot declare pointer to function returning ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 22 01:00:27 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2753





------- Comment #2 from maxmo at pochta.ru  2009-03-22 03:00 -------
judging from compiler error messages, ref is not a type modifier, it's a
function attribute, so brackets won't help. It should also be noted, that
others function attributes' grammar is also ambiguous.
---
nothrow int function() foo();
---
What is nothrow here?

---
const int foo();
---
What is const here?

---
int foo(ref int function() goo);
---
This one would probably give no error.

Is it keyword saving issue? Semantically different things have the same syntax.
If Walter wants context-dependent keywords, he should mark those contexts
better.
I would like to see function attributes at predictable, easy-to-spot locations,
so it would be no chanse to mess storage class with function attributes. There
are already good places for function attributes (after function) and storage
class attributes (before type). If the attributes will be restricted to
corresponding places, there will be no ambiguity (except const).
---
int foo(ref int function() goo); //ref parameter
int goo(int function() ref foo); //return byref function
---


-- 



More information about the Digitalmars-d-bugs mailing list