>>1192
>in addition to being unclear (what's the purpose?)
Serialization. It's either JSON, XML, ASN.1, Protocol Buffers, etc, etc.
>[This] changes the question to one where the language arbitrarily chose something out of the things that serve the purpose.
Yep.
>There is no "different arithmetic" serving the same purpose as standard arithmetic
I dunno… Why not define subtraction of natural numbers so sub(x,y) fails if y is greater than x? What's the correct way?
Why not have Naturals as well as Integers?
When inducing a protocol from types (as opposed to specifying bits or using some doodoo like Protocol Buffers or JSON), this is decent gain, because now the protocol specifies exactly what's acceptable and we don't need some comment (or clause in a spec) which everyone ignores, and we also don't need a bunch of runtime checks everywhere. Of course now we're more likely to need conversion from Natural to Integer or whatever once in a while but I feel it's more explicit and the other way around just lets lazy programmers not care about the edge cases.
We can have whatever types we want:
Integer: …-3,-2,-1,0,1,2,3…
Natural: 0,1,2,3…
Positive: 1,2,3,4…
Rational: +/- …1/1,2/1,3/1,4/1,1/2,2/2,3/2,4/2…
>Again, I get the intense feeling that you say "number" and "number type" but mean something completely different like "number syntax" or "special handling for numbers"
When talking about existing PLs, I mean the whole part of the PL dealing with numbers - the syntax, the implementation, the type the language provides to the user (i.e, ->int<- x = 3). When talking about my language, I just mean the user-defined type, and I guess whatever functions he defines on it.
>if there is no standardized representation I don't see how you'd exchange programs with anything that doesn't natively understand whatever the implementation uses
There _is_ a standardized representation, it's just this (abstractly, how it's encoded is a different matter):
x = Empty
y = One (Empty)
z = One (One Empty)
Instead of
x = 0
y = 1
z = 2
…and then it's completely up to the code viewer whether to display 0 instead of Empty
For the purpose of demonstration, if I wanted to work with existing languages, I could have a Haskell program like
f (a, b) = some_function (a, One Empty, b, One (One Empty))
and make an editor for Haskell code and provide the GUI with Alt+A explained in >>1191
But I wont do that, because that's tiny gains, it only becomes worth it in a completely different environment than standard UNIX-based OS and text-based PL.
>So how would a language "without a number type" look like?
Like Haskell or SML or Lisp without built in numbers. What I said before, the user can define his own natural type like this:
data Natural = One Nat | Zero Nat | Empty
And even positive numbers:
data Positive = P_0 Positive | P_1 Positive2
data Positive2 = P2_0 Positive2 | P2_1 Positive2 | P2_End
(The automata in pic related can help in understanding it. It's a binary representation of any number 1 or greater. It's LSB-first though!)
No builtin number library. No builtin syntax for numbers. The only types are algebraic datatypes defined by the user and which libraries he chooses to use. Numbers are built by defining algebraic data types. Same with anything else you want, lists, maps, sets, DNA, whatever, and syntax for these types can be defined separately, through editor "plugins"
without any plugins to the editor, you just see the value as it actually is, e.g:
P_0 (P_0 (P_1 P2_End))