Extended arrays declaration and access syntax with use of enumerated types

Gabriel Belingueres belingueres at gmail.com
Fri Mar 13 10:06:53 PDT 2009


ALTERNATIVES none?

You could use a Map implementation, or even a SortedMap implementation
if you need to keep an order between the keys.

Regards,
Gabriel

2009/3/13, Алексей Кузнецов <kuaw26 at mail.ru>:
> PROJECT COIN SMALL LANGUAGE CHANGE PROPOSAL FORM v1.0
>
> AUTHOR(S): Alexey Kuznetsov
>
> OVERVIEW
>  Extend arrays declaration and access syntax with use of enumerated types
>
> FEATURE SUMMARY:
>  Self-explaining syntax for declaring and accessing arrays.
>  See examples.
>
> MAJOR ADVANTAGE:
>  1) The code would be more typesafe.
>  2) The code would be more compact and self-explained
>
> MAJOR BENEFIT:
>  More checks at compile time.
>
> MAJOR DISADVANTAGE:
>  Associated costs in documentation, tutorials and overall language size.
>
> ALTERNATIVES:
>  None.
>
> EXAMPLES
>  SIMPLE EXAMPLE:
>  String[] strs = new String[boolean];
>  strs[false] = "some str_1";
>  strs[true] = "some str_2";
>  boolean someFlag = true;
>  System.out.println(strs[b]);
>
>  ADVANCED EXAMPLE:
>
>  public enum MyEnum
>  {
>  one, two, three;
>  }
>  Integer[] ints = new Integer[MyEnum];
>  ints[MyEnum.one] = 1;
>  ints[MyEnum.two] = 2;
>  ints[MyEnum.three] = 3;
>  System.out.println(ints[MyEnum.one]);
>
> DETAILS
> SPECIFICATION:
>  ?
>
> COMPILATION:
>  As today.
>
> TESTING:
>  ?
>
> LIBRARY SUPPORT:
>  None.
>
> REFLECTIVE APIS:
>  No.
>
> OTHER CHANGES:
>  No.
>
> MIGRATION:
>  A trivial textual substitution can be used to translate old code to the new syntax.
>
> COMPATIBILITY
>
> BREAKING CHANGES:
>  None.
>
> EXISTING PROGRAMS:
>  No impact.
>
> REFERENCES
>
> EXISTING BUGS:
>  None.
>
> URL FOR PROTOTYPE (optional):
>  None.
>
>



More information about the coin-dev mailing list