Skip to content

signature

pannous edited this page Nov 14, 2020 · 1 revision

The signature of a function describes the parameter type of a function without giving the implementation body and without necessary naming of the arguments.

The preferred way to do this is the triple dot notation: to add number to number... to add number to number... as number to add number to number... returns number

Typing in angle functions can be inferred, provided inline or outside of the declaration:

  • inferred: to add a to b: a+b crystal style
  • inline: to add number a to number b: a+b
  • with return type: to add number a to number b as number: a+b
  • add(a: number b: number): number { a+b } swift style
  • outside to add number to number...
  • outside add :: number number : number haskell header

Again all these visual representations are just a matter of taste. Under the hood all are represented uniformly. If code is generated back the output depends on the linker flags:

  • generate typeless functions
  • implicit return type
  • explicit return type
  • inline function types
  • outline function types
  • coloned types ( a: number vs number a)

If an outside declaration appears not adjacent to the function declaration, polymorphism conflicts may generate compiler warnings and errors such as

  • header signature not matched by implementation...
  • ambivalent header signature and implementation...

Note that the keywords as and return in
to add number to number... as number
to add number to number... returns number Act differently to how the would act in a function body: Here as is the cast operator and return does control flow. In a sense the triple dot quotes these keywords.

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