jsigbiz / spec

JavaScript signature notation
130 stars 6 forks source link

Without operator #46

Open junosuarez opened 9 years ago

junosuarez commented 9 years ago

issue from #28

\ allows you to specify a type that is a union with things.

For example the divide : (top: Number, bottom: Number \ 0) => Number function.

This is the inverse of | and is useful when thinking of types as sets.

+1, this is helpful for thinking about types as sets of properties. @Raynos can you document where the syntax is from in this thread? I'm neutral on the proposed syntax. I have a goal of having jsig syntax "look" as familiar as possible to JavaScript programmers, but there's not an existing concept that maps exactly. | comes from JavaScript bitwise or.

Raynos commented 9 years ago

The \ operator comes from the notion of a Relative set complement i.e. directly from my mathematical set theory.

junosuarez commented 9 years ago

Via your link, it's also the notation from http://en.wikipedia.org/wiki/ISO_31-11#Sets so LGTM.