Anonymous structs

Era Scarecrow rtcvb32 at yahoo.com
Wed Feb 13 05:02:38 PST 2013


On Wednesday, 13 February 2013 at 10:35:08 UTC, Jacob Carlborg 
wrote:
> My suggestion is for anonymous structs, nothing else. It can 
> only contain declarations of fields. I would thought that was 
> pretty clear, especially since the subject says "Anonymous 
> structs" and not something like "Anonymous delegates".

  I'm aware of that.

> I also showed how the syntax is lowered into a regular named 
> struct, which would make things even more clear. But apparently 
> not.
>
> Is my English so bad or is it just the idea that is so bad?

  More like how to make it syntactically proper/unambiguous & 
compatible so the compiler could identify and use it properly; 
Sudden new use(s) of code blocks without somehow clarifying it's 
intended use (before hand) could be a problem, or worse yet, 
prevent something better later if it's introduced & used (and you 
get the same C++ issues where you can't fix/change something 
without breaking anything relying on a defined feature). 
Remember, just cause it seems simple (to us) doesn't mean it's 
simple.

  Maybe I'm thinking too far ahead... How much extra complexity 
would be be to add the feature? If we're using say Lex & Yacc for 
example a simple feature would be only a couple lines; If you 
need to make whole new branch(es) then it may not be a good idea. 
If it requires complex rules, then it may not be reliable as we 
won't remember them all while we're programming.


More information about the Digitalmars-d mailing list