Skip to content
Pannous edited this page Oct 24, 2022 · 5 revisions

alias

Aliases are an important mechanism in angle to norm synonyms.

The idea is that developers don't need to memorize specific variants (length, size, count) but are directed to the standard (correct/main) form. The normed synonym is handled at an early system level, similar to how in python the '+' operator resolves to the method 'add' on objects.

cross resolution

If an object defines any synonym (e.g. one of length, size, count), this property can be accessed via all forms of its aliases.

ambiguous resolution

If an object defines multiple synonymous properties (e.g. length, size, count) these can still be used individually. A compiler warning may be emitted, warning developers that they are overloading aliases.

adding aliases

aliases can be added at compile time and runtime via keyword alias : alias length = count or alias length => count to indicate the standard form.

aliasing internal keywords

internal keywords can have aliases too, similar to c's #define, but they need to be quoted as symbol :

alias typedef => :alias

type aliases

same syntax as other aliases:

alias u32  => unsigned int
alias i32u => u32

aliases.wasp

#operator alias are important for unicode : The following shall be mapped early to minus early in parsing:

0x2010  8208    HYPHEN  ‐
0x2011  8209    NON-BREAKING HYPHEN ‑
0x2012  8210    FIGURE DASH ‒
0x2013  8211    EN DASH –
0x2014  8212    EM DASH —
0x2015  8213    HORIZONTAL BAR  ―

etc

range

aliases in wasm

To express aliases inside wast/wasm use the _alias_ naming convention prefix:

	(export "log10"        (func $log10))
  (export "_alias_log₁₀" (func $log10))
  (export "_alias_₁₀⌞"   (func $log10))
  (export "_alias_10⌞"   (func $log10))

Angle takes care of the semantics.

⚠️ Todo: does wasp have access to the (func $log10) name? otherwise this convention is dependent on previous declaration of (export "log10" (func $log10)).

Ugly workaround: (export "_alias_log₁₀__log10")

Todo how to norm?

when to warn developers about the standard form and when not:

1. convert this log₁₀ to log10
2. convert all  log₁₀ to log10
3. convert this log10 to log₁₀
4. convert all  log10 to log₁₀
5. ignore this
6. ignore all alias warnings for log₁₀
Your choice will be stored in alias-preferences.wasp and can be edited any time. 
Your preferences it will still be normed to the Angle default standard alias when using git.
"```

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally