It's not uncommon to have domain overlap between lists of valid tokens 
(used for validations) and type specs. For example:

  @standard_formats [
    :standard,
    :accounting,
    :currency,
    :percent
  ]

  @currency_formats [
    :currency,
    :accounting,
    :currency_long,
    :currency_short
  ]

  @currency_symbol [
    :standard,
    :iso
  ]

  @type standard_formats :: :standard | :currency | :accounting | :short | 
:long
  @type currency_formats ::  :currency_short | :currency_long | 
:decimal_short | :decimal_long
  @type currency_symbol :: :standard | :iso

It would go good to remove one source of error by being able to allow 
compile time use of a list as the subject of  @typespec. For example:

@type currency_symbol :: @currency_symbol # Any compile-time resolvable list

Of course a macro can be introduced to do this but its quite difficult to 
achieve since it requires manual manipulation of AST.

Proposal worth considering? Or consign to the history of my 
less-than-helpful ideas :-)


-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/36f821aa-d718-48aa-a9e8-2f6d5e440632%40googlegroups.com.

Reply via email to