Skip to content

Reorder type/typedef arguments #11

Open
@j-woz

Description

@j-woz

From @GoogleCodeExporter on April 22, 2015 19:5

Currently the order is:

type the_new_type the_old_type;
typedef alias_for_old_type the_old_type;

In C the order is reversed:
typedef the_old_type alias_for_old_type;


Alternatives:
1. Do nothing
2. Swap them
3. Support both - infer which is meant
4. Detect C ordering, suggest user swaps it (either error or warning)

Alt 1:
Pros:
* Easy
* Backwards compatible with existing scripts
* Consistent with struct declarations: type <new type name> <definition of type>
   type the_new_type { ... } 
   type the_new_type the_old_type

Cons:
* Some ongoing confusion for developers familiar with C

Alt 2:
Pros:
* Consistent with C

Cons:
* Somewhat inconsistent with the struct declaration order
* Breaks backwards compatibility

Alt 3:
Pros:
* Whichever alternative user writes will work - no read error->edit->compile 
cycle required

Cons:
* Some minor implementation work
* More than one way to do same thing - overhead of documentation, inconsistency 
between user's code, etc
* Errors messages may be slightly less helpful, since we don't know which way 
was intended.

Alt 4:
Pros:
* Backwards compatibility/consistency (see Alt 1)
* No changes to language/docs

Cons:
* Some minor implementation work
* Requires C user to do another read warning/error -> edit -> compile cycle

Original issue reported on code.google.com by tim.g.ar...@gmail.com on 6 Feb 2015 at 3:57

Copied from original issue: j-woz/exm-issues#773

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions