How can someone make sure a new language is 'complete', i.e. that no essential is left out and that it will allow a programmer to do anything
he might need to do?
How can someone make sure a new language is 'complete', i.e. that no essential is left out and that it will allow a programmer to do anything
he might need to do?
The reason for asking is that I recently realised that I had to add a
new parameter mode. Because of certain choices I found I couldn't get
away with just in, inout and out so I had to add a new mode. I'm
avoiding going in to the details as they could divert from the topic but
the point is that I found that something was missing and it got me
wondering what else could be needed.
So is there a way to make sure a new language is complete?
AISI first of all there's computational or 'Turing' completeness. For
that, perhaps it's enough to ensure that the language has selections and loops. But then there are other things - such as the parameter-mode
example, above. How does one make sure nothing is missing?
One approach is probably to base a new language on an existing one. Then
as long as the earlier language is complete it should be easier to make
sure the new one is, too. But even that has its weaknesses. For example,
one might base a new language on C but then find that some things cannot
be done - or cannot be done reasonably - without the preprocessor.
If attempting to create a new language without an antecedent then the situation is even more challenging. There will be no prior model to
guide the design.
So, any suggestions?
On 14/12/2021 11:58, James Harris wrote:
How can someone make sure a new language is 'complete', i.e. that no
essential is left out and that it will allow a programmer to do anything
he might need to do?
(Quibble - the preprocessor in C is part of C, just as its standard
library is part of it. There are different phases of translation from
source to final binary, but it is wrong to think "you should be able to
do this in C without the preprocessor". That is like thinking that
since you bought your car's tires from a different shop than the car,
the car should be able to run without tires. It makes no sense.
For /your/ purposes, your language is not complete without 4 parameter passing modes (in, out, inout, and a forth one - shake it all about?).
C, on the other hand, manages perfectly well with just one mode for parameters.
Does that mean C is incomplete? Yet people use it for all
sorts of things.
How can someone make sure a new language is 'complete', i.e. that no essential is left out and that it will allow a programmer to do anything
he might need to do?
The reason for asking is that I recently realised that I had to add a
new parameter mode. Because of certain choices I found I couldn't get
away with just in, inout and out so I had to add a new mode. I'm
avoiding going in to the details as they could divert from the topic but
the point is that I found that something was missing and it got me
wondering what else could be needed.
So is there a way to make sure a new language is complete?
AISI first of all there's computational or 'Turing' completeness.
For
that, perhaps it's enough to ensure that the language has selections and loops. But then there are other things - such as the parameter-mode
example, above. How does one make sure nothing is missing?
One approach is probably to base a new language on an existing one. Then
as long as the earlier language is complete it should be easier to make
sure the new one is, too. But even that has its weaknesses. For example,
one might base a new language on C but then find that some things cannot
be done - or cannot be done reasonably - without the preprocessor.
If attempting to create a new language without an antecedent then the situation is even more challenging. There will be no prior model to
guide the design.
So, any suggestions?
On 14/12/2021 13:34, David Brown wrote:
On 14/12/2021 11:58, James Harris wrote:
How can someone make sure a new language is 'complete', i.e. that no
essential is left out and that it will allow a programmer to do anything >>> he might need to do?
(Quibble - the preprocessor in C is part of C, just as its standard
library is part of it. There are different phases of translation from
source to final binary, but it is wrong to think "you should be able to
do this in C without the preprocessor". That is like thinking that
since you bought your car's tires from a different shop than the car,
the car should be able to run without tires. It makes no sense.
You've lost me with that analogy.
A better one I think is that C is like buying a car that comes with a
trailer that contains a workshop for creating ad-hoc, home-made versions
of all those features that on other cars are built-in.
For /your/ purposes, your language is not complete without 4 parameter
passing modes (in, out, inout, and a forth one - shake it all about?).
C, on the other hand, manages perfectly well with just one mode for
parameters.
Value-passing mode, which in the case of arrays, actually is in
complete. There it actually switches to passing by reference.
 Does that mean C is incomplete? Yet people use it for all
sorts of things.
As they do assembly. Completeness in terms of being able to accomplish
any task is not enough.
On 14/12/2021 10:58, James Harris wrote:
How can someone make sure a new language is 'complete', i.e. that no
essential is left out and that it will allow a programmer to do
anything he might need to do?
I'm not sure any practical language can be that complete.
There will always be something it can't do, or can't do easily.
AISI first of all there's computational or 'Turing' completeness.
(What parameter passing modes did the original Turing Machine support?
Just out of interest...)
So you can say a systems language should at least be able to do what C
can. But people do crazy things with the C proprocessor like implement a complete functional language. I just wouldn't go that far.
On 14/12/2021 14:28, Bart wrote:
So you can say a systems language should at least be able to do what C
can. But people do crazy things with the C proprocessor like implement a
complete functional language. I just wouldn't go that far.
You can't do that with the C preprocessor, because there is no way to implement recursion or loops.
On 14/12/2021 15:59, David Brown wrote:
On 14/12/2021 14:28, Bart wrote:
So you can say a systems language should at least be able to do what C
can. But people do crazy things with the C proprocessor like implement a >>> complete functional language. I just wouldn't go that far.
You can't do that with the C preprocessor, because there is no way to
implement recursion or loops.
How about this one:
https://github.com/camel-cdr/bfcpp/blob/main/TUTORIAL.md
(Brainf*ck intepreter using CPP)
How can someone make sure a new language is 'complete', i.e. that no essential is left out and that it will allow a programmer to do
anything he might need to do?
The reason for asking is that I recently realised that I had to add a
new parameter mode. Because of certain choices I found I couldn't get
away with just in, inout and out so I had to add a new mode. I'm
avoiding going in to the details as they could divert from the topic
but the point is that I found that something was missing and it got
me wondering what else could be needed.
So is there a way to make sure a new language is complete?
[...[
One approach is probably to base a new language on an existing one.
Then as long as the earlier language is complete it should be easier
to make sure the new one is, too. But even that has its weaknesses.
For example, one might base a new language on C but then find that
some things cannot be done - or cannot be done reasonably - without
the preprocessor.
If attempting to create a new language without an antecedent then the situation is even more challenging. There will be no prior model to
guide the design.
So, any suggestions?
On 14/12/2021 14:51, Bart wrote:
On 14/12/2021 13:34, David Brown wrote:
On 14/12/2021 11:58, James Harris wrote:
How can someone make sure a new language is 'complete', i.e. that
no essential is left out and that it will allow a programmer to
do anything he might need to do?
(Quibble - the preprocessor in C is part of C, just as its standard
library is part of it. There are different phases of translation
from source to final binary, but it is wrong to think "you should
be able to do this in C without the preprocessor". That is like
thinking that since you bought your car's tires from a different
shop than the car, the car should be able to run without tires.
It makes no sense.
You've lost me with that analogy.
A better one I think is that C is like buying a car that comes with
a trailer that contains a workshop for creating ad-hoc, home-made
versions of all those features that on other cars are built-in.
No, that's not helpful at all. (But to be fair, my analogy was not
great either.)
The point is that you can build a C implementation with a preprocessor
from one supplier, a core language compiler from somewhere else, and
a C standard library from a third supplier - but you don't have /C/
unless they are all together and all compatible with each other. It
makes no sense to say "C without the preprocessor" or "C without the
standard library". "C" is the programming language described in the
C standards
- no more, and no less.
For /your/ purposes, your language is not complete without 4
parameter passing modes (in, out, inout, and a forth one - shake
it all about?). C, on the other hand, manages perfectly well with
just one mode for parameters.
Value-passing mode, which in the case of arrays, actually is in
complete. There it actually switches to passing by reference.
In practice, it appears that way - technically, however, the array
expression decays to a pointer expression and the pointer is passed by
value.
You can see this from the way functions are declared - even if
you make a parameter that appears to be an array, it is equivalent to
a pointer to the first element.
ARRAYS IN C:Array types are defined in the standards, 6.2.5p20.
How can someone make sure a new language is 'complete', i.e. that no essential is left out and that it will allow a programmer to do anything
he might need to do?
The reason for asking is that I recently realised that I had to add a
new parameter mode. Because of certain choices I found I couldn't get
away with just in, inout and out so I had to add a new mode. I'm
avoiding going in to the details as they could divert from the topic but
the point is that I found that something was missing and it got me
wondering what else could be needed.
So is there a way to make sure a new language is complete?
AISI first of all there's computational or 'Turing' completeness. For
that, perhaps it's enough to ensure that the language has selections and loops. But then there are other things - such as the parameter-mode
example, above. How does one make sure nothing is missing?
One approach is probably to base a new language on an existing one. Then
as long as the earlier language is complete it should be easier to make
sure the new one is, too. But even that has its weaknesses. For example,
one might base a new language on C but then find that some things cannot
be done - or cannot be done reasonably - without the preprocessor.
If attempting to create a new language without an antecedent then the situation is even more challenging. There will be no prior model to
guide the design.
So, any suggestions?
[...] Hoare doesn't
really deal with making sure a language is complete and some of his
comments relate to the time when the paper was written. But others of
them are timeless. It's a pity there aren't thinkers of his type
still around - at least I don't know of any.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 295 |
Nodes: | 16 (2 / 14) |
Uptime: | 02:44:36 |
Calls: | 6,642 |
Calls today: | 2 |
Files: | 12,190 |
Messages: | 5,325,502 |