Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
The D Programming Language
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 50 of 196 - Collapse all  -  Translate all to Translated (View all originals) < Older  Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Harter  
View profile  
 More options Feb 25 1988, 4:35 am
Newsgroups: comp.lang.c
From: g...@cca.CCA.COM (Richard Harter)
Date: 25 Feb 88 09:35:33 GMT
Local: Thurs, Feb 25 1988 4:35 am
Subject: Re: The D Programming Language

In article <2...@mmintl.UUCP> fra...@mmintl.UUCP (Frank Adams) writes:
>In article <2...@umd5.umd.edu> ch...@trantor.umd.edu (Chris Torek) writes:

>|[may prefer 'endif' to 'end', but has doubts]

>I debated whether to put in 'endif', etc., or 'end' in the above, and
>finally opted for the shorter form.  Ask me on another day and you might get
>a different answer.

Here is an alternative to endif et al.  Use labels to start blocks and
'end labels' to end them.  For example,

        if (boolean expression)
foo:            ....
                end foo
        else
bar:            ....
                end bar

This may look odd, but it does have the advantage that it makes the block
delimiting explicit.  One would also need to be able to use unlabelled blocks
(in macros, for example), so

        if (boolean expression)
                ....
                end
        else
                ....
                end

would also fly.  A disadvantage (from some viewpoints) is that, since labels
now delimit control blocks, they can't be used for goto's.

Sometimes, I think this might be a good idea.
--

In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
        Richard Harter, SMDS  Inc.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Tobin  
View profile  
 More options Feb 25 1988, 12:43 pm
Newsgroups: comp.lang.c
From: rich...@aiva.ed.ac.uk (Richard Tobin)
Date: 25 Feb 88 17:43:09 GMT
Local: Thurs, Feb 25 1988 12:43 pm
Subject: Re: The D Programming Language

In article <9...@PT.CS.CMU.EDU> e...@IUS1.CS.CMU.EDU (Eddie Wyatt) writes:
>> >I think I would also drop the convention that 0 is a null pointer.  Make
>> >"null" a keyword, representing a null pointer of any type.
>> This would, at one stroke, eliminate half the confusion that plagues
>> comp.lang.c ....  (about 1/3 :-) )
>  Unless you require function prototypes to be within scope, null
>will not do you much good.

Ah, but if you you don't make the representation of the null pointer
be the same as that of an integer (or anything else) then you can make
it illegal to pass it (uncast) to a function for which there is no
prototype.  You can't do that with zero, unless you want to have to say
(int)0 to pass an integer zero.

Of course, when designing a new language you certainly could require
that functions never be used unless there is a prototype (or
"declaration" as one might call it) in scope.

-- Richard
--
Richard Tobin,                         JANET: R.To...@uk.ac.ed            
AI Applications Institute,             ARPA:  R.Tobin%uk.ac...@nss.cs.ucl.ac.uk
Edinburgh University.                  UUCP:  ...!ukc!ed.ac.uk!R.Tobin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language (was: Still more new operators)" by Henry Spencer
Henry Spencer  
View profile  
 More options Feb 25 1988, 3:22 pm
Newsgroups: comp.lang.c
From: he...@utzoo.uucp (Henry Spencer)
Date: Thu, 25 Feb 88 20:22:37 GMT
Local: Thurs, Feb 25 1988 3:22 pm
Subject: Re: The D Programming Language (was: Still more new operators)

> ... An undeclared variable should be an error, not an int.

Um, perhaps you should learn C before you start designing D...?  An
undeclared variable *is* an error.

> Another thing that should go is the assumption that the unit of storage is
> the byte.  The base unit of storage is the bit, and sizeof should return the
> number of bits in the object.  This enables to treat objects smaller than a
> byte as first class objects.

Here we have a key decision:  is D to share C's emphasis on generation
of efficient code?  (Bearing in mind that this had a lot to do with C's
success.)  If so, then trying to forget that bytes exist is a serious
mistake.  Most machines cannot handle bits with anywhere near the efficiency
with which they handle bytes; the appropriate base unit for efficient code
*is* the byte.

> ... In keeping with the spirit of C, we avoid
> superfluous words, and keep the ones we do use short.

> With these changes, the {} statement delimiters become much less useful.  I
> would probably drop them, and add a "begin ... end;" construct...

Please explain how avoiding superfluous words and keeping necessary ones
short is consistent with changing {/} to begin/end for no particular reason.

> To get even more radical -- with typedefs, enums, const declarations, and
> (if we add them) inline functions, do we really need the pre-processor any
> more? ...

The C++ people claim that the answer is "not much", given inline functions
in particular.  They do still use it for some specialized problems, though.

> I would omit the automatic insertion of a null byte at the end of character
> constants.  If you want nul terminated strings, write the nul.  If you want
> strings with counts, the language should not get in your way.

Pray tell, how do you write a counted-string constant?  I would suggest
that "abc" should mean a length-3 string with any necessary terminator,
regardless of what flavor of string is in use.  That way you get a choice,
without recoding all your string constants.
--
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Portable "asm" (Was: The D Programming Language)" by Henry Spencer
Henry Spencer  
View profile  
 More options Feb 25 1988, 3:34 pm
Newsgroups: comp.lang.c
From: he...@utzoo.uucp (Henry Spencer)
Date: Thu, 25 Feb 88 20:34:25 GMT
Local: Thurs, Feb 25 1988 3:34 pm
Subject: Re: Portable "asm" (Was: The D Programming Language)

> If we have the compiler replace names by locations (register and/or memory)
> of the variables used...

This does of course assume that all locations are addressable in all
instructions, which is emphatically not the case on many machines.

> We also should get rid of those quotes in the process...

What if I want to write asm("mov ')', r0")?  The quotes are a reasonable way
of keeping the syntax of the assembler entirely out of the compiler's own
syntax handling, which is a good thing, especially for portable compilers.
--
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language (was: Still more new operators)" by Mark Brader
Mark Brader  
View profile  
 More options Feb 25 1988, 7:19 pm
Newsgroups: comp.lang.c
From: m...@sq.uucp (Mark Brader)
Date: Thu, 25-Feb-88 19:19:57 EST
Local: Thurs, Feb 25 1988 7:19 pm
Subject: Re: The D Programming Language (was: Still more new operators)

> Any serious effort to design a successor to C (which does not attempt to
> be upward compatible) should first consider what should be taken out and/or
> done differently.  Adding new things is secondary.

> The first thing I would remove is the automatic conversion of arrays to
> pointers.

So far I agree.

> (A consequence of this change is that "a[b]" is no longer definable as
> "*(a + b)".

Here I disagree.  We can have it both ways.  Allow automatic conversion
of arrays to pointers *where pointers are required*.  That is, if you say
"b = a;", where a is an array, you get *either* a pointer assignment or
an array assignment, depending on whether b is a pointer or array variable.

The present definitions of * and [] can then be happily retained.  In fact,
the entire present treatment of arrays can be happily retained, and thus
arrays-as-first-class-objects could go into C itself -- except for one thing.
Function calls.

If the rule was that a prototype of the form "void fun (int a[4], int *b);"
declared a function with one array and one pointer argument, then calls to
this function could follow the semantics I outlined above; a call of the form
fun(a,a); would pass the whole array a as the first argument, and a pointer
to its start as the second argument.  (Barring some form of "conformant
arrays", the dimension 4 would have to match exactly.)

Of course, in the present draft, that declaration declares a function with
two pointer arguments.  If this becomes as entrenched in the language in
connection with the new prototype syntax as it is with the old function
definition syntax, we will never get arrays-as-first-class-objects.
This is one reason why I and others have suggested that declarations such
as the above should at least cease to have their present meaning.

Mark Brader                             "C takes the point of view
SoftQuad Inc., Toronto                   that the programmer is always right"
utzoo!sq!msb, m...@sq.com                              -- Michael DeCorte


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gordan  
View profile  
 More options Feb 26 1988, 11:12 pm
Newsgroups: comp.lang.c
From: gor...@maccs.UUCP (gordan)
Date: 27 Feb 88 04:12:29 GMT
Local: Fri, Feb 26 1988 11:12 pm
Subject: Re: The D Programming Language (was: Still more new operators)
-> ... An undeclared variable should be an error, not an int.
-
- [various flames stating that an undeclared variable *is* an error]

Perhaps what the original poster meant by his statement was that, for
instance, the following is legal:

  foo (a, b)
  char a;     /* b is implicitly an int */
  {
   ...
  }

(Chapter and verse:  K & R, Appendix A, Section 10.1, "Any identifiers
whose type is not given are taken to be _int_.").

Of course, in the above example, 'b' is not a variable, but a formal
parameter.  Still, this is a problem... I once had a hard-to-find bug
that resulted from a missing formal parameter declaration defaulting to
int.  _Has_ this been changed in ANSI C?
--
I am the Lizard King    "Vous cherchez Jim, Monsieur?"
and I can do anything
                          -- caretaker at                Gordan Palameta
 -- Jim Morrison             Pere Lachaise      mnetor!lsuc!maccs!gordan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Jones  
View profile  
 More options Feb 27 1988, 4:25 am
Newsgroups: comp.lang.c
From: jejo...@mcrware.UUCP (James Jones)
Date: 27 Feb 88 09:25:54 GMT
Local: Sat, Feb 27 1988 4:25 am
Subject: Re: The D Programming Language (was: Still more new operators)
In article <1988Feb25.202237.8...@utzoo.uucp>, he...@utzoo.uucp (Henry Spencer)
writes:

> > ... An undeclared variable should be an error, not an int.

> Um, perhaps you should learn C before you start designing D...?  An
> undeclared variable *is* an error.

Perhaps the original author was referring to letting undeclared identifiers
which are followed by something that looks like an actual parameter list
default to being an extern function returning int, and to the ability to
elide int from declarations (which, if I rightly understand the X3J11 Draft,
can still be done as long as there's *some* keyword that lets the compiler
conclude that it's looking at a declaration).  If that's indeed what the
original author was referring to, I sincerely agree with him.  (It would
be nice if X3J11 deprecated it, too--which it may have, I don't recall.)

                James Jones


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language" by Richard A. O&#39;Keefe
Richard A. O'Keefe  
View profile  
 More options Feb 27 1988, 6:39 am
Newsgroups: comp.lang.c
From: o...@quintus.UUCP (Richard A. O'Keefe)
Date: 27 Feb 88 11:39:48 GMT
Local: Sat, Feb 27 1988 6:39 am
Subject: Re: The D Programming Language
In article <24...@cca.CCA.COM>, g...@cca.CCA.COM (Richard Harter) writes:
> Here is an alternative to endif et al.  Use labels to start blocks and
> 'end labels' to end them.  For example,

>    if (boolean expression)
> foo:               ....
>            end foo
>    else
> bar:               ....
>            end bar

He has just re-invented BCPL.  Where C has { and }, BCPL had $( and $).
The name for these was "section brackets".  There was an extra hack:
"tagged section brackets".  If <id> looked like an identifier,
$(<id> and $)<id> were tagged section brackets (each was a single token).
So in BCPL this example would be
        TEST boolean-expression THEN
            $(FOO
                ...
            $)FOO
        ELSE
            $(BAR
                ...
            $)BAR

PL/I has a similar feature, one can write
        label: DO;
            statements
        END label;      /* I may have this wrong */
There is a difference, though.  In BCPL, the tags on the brackets must
match exactly, but in PL/I a tagged END may close any number of tagged
and untagged DOs.

Can anyone who has experience with using this feature suggest why it has
remained rare.  In particular, does anyone know why it isn't in C, given
that it was in BCPL?  (Not that I think it's needed.)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Portable "asm" (Was: The D Programming Language)" by Herman Rubin
Herman Rubin  
View profile  
 More options Feb 27 1988, 6:51 am
Newsgroups: comp.lang.c
From: c...@l.cc.purdue.edu (Herman Rubin)
Date: 27 Feb 88 11:51:56 GMT
Local: Sat, Feb 27 1988 6:51 am
Subject: Re: Portable "asm" (Was: The D Programming Language)

In article <1988Feb25.203425.8...@utzoo.uucp>, he...@utzoo.uucp (Henry Spencer) writes:
> > If we have the compiler replace names by locations (register and/or memory)
> > of the variables used...

> This does of course assume that all locations are addressable in all
> instructions, which is emphatically not the case on many machines.

This is another reason for the user to be able to force the compiler to put
things in registers.  The stupid compiler should not be able to force the
user to use many instructions because it does not see the need for register
variables.  This applies also to such constructs as register pairs, triples,
etc.  Naturally, this would require some way of modifying the register number,
but so what?  This is simple, compared to the machinations that compilers
now undertake.

Also, it is rash to assume that the programmer does not make mistakes.  If the
location types of the arguments do not work with the instruction, this is a
programming error; what are diagnostic and error messages for?

> > We also should get rid of those quotes in the process...

> What if I want to write asm("mov ')', r0")?  The quotes are a reasonable way
> of keeping the syntax of the assembler entirely out of the compiler's own
> syntax handling, which is a good thing, especially for portable compilers.

Someone has posted an example where the failure was due to a " in the assembler
instruction.  It is just as easy, since C requires a ; to end a statement, to
tell the compiler that until it sees ); to continue processing for the
assembler, and to have some escape mechanism for inserting ); into the
assembler statement.  Alternatively, if we get rid of the ;s as mandatory
terminators (which I think is a good idea), have an escape mechanism for
inserting ) in an assembler statement.  Is this worse than not being able
to put ", or even "), in an assembler statement?

--
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054
hru...@l.cc.purdue.edu (ARPA or UUCP) or hru...@purccvm.bitnet


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language, labelled blocks" by Richard Harter
Richard Harter  
View profile  
 More options Feb 27 1988, 6:14 pm
Newsgroups: comp.lang.c
From: g...@cca.CCA.COM (Richard Harter)
Date: 27 Feb 88 23:14:38 GMT
Local: Sat, Feb 27 1988 6:14 pm
Subject: Re: The D Programming Language, labelled blocks
In article <7...@cresswell.quintus.UUCP> o...@quintus.UUCP (Richard A. O'Keefe) writes:

>In article <24...@cca.CCA.COM>, g...@cca.CCA.COM (Richard Harter) writes:
>> Here is an alternative to endif et al.  Use labels to start blocks and
>> 'end labels' to end them....
>He has just re-invented BCPL.

        Er, you give me too much credit.  A feature of BCPL, perhaps,
but not the whole thing> :-)

As it turns out I do have experience with this exact feature in PL/I.
I once inherited a 40,000 line PL/I program with a 5000 line main program
which used nested tagged begin/end blocks.  I can tell you that multiple
closure is a real disaster.  Fundamentally, the problem is that you can
remove an end statement, thereby changing the block structure of the program,
and the program is still syntactically correct and compiles.  In a large
program which runs across many pages you can't visually confirm that all
the blocks align properly.  It's been a long time now, and I can't recall
the gory details any more.  However the practical effect was the same as
having a C switch construct with some of the terminating case 'break'
statements unintentionally missing.

As a side point, I like the suggestion that someone made that there be
a fallthrough statement rather than automatic fallthrough.

As to rarity of usage, I suspect the problem is that it is a nice feature
if you use it in a standardized disciplined manner, but that if it is not
obligatory it will be used haphazardly, and that it has no particular value
in that case.   Now that I think on it, you don't need it for small pieces
of code, where everything is clear.  It may have some value for large
programs (as in large number of lines per file).  However my experience
is that the way to deal with the difficulties created by writing large
procedures is not to not write large procedures! :-).

OK, Richard, you win -- D should not have labelled blocks.

--

In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
        Richard Harter, SMDS  Inc.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language (was: Still more new operators)" by Doug Gwyn
Doug Gwyn  
View profile  
 More options Feb 27 1988, 7:32 pm
Newsgroups: comp.lang.c
From: g...@brl-smoke.ARPA (Doug Gwyn )
Date: 28 Feb 88 00:32:41 GMT
Local: Sat, Feb 27 1988 7:32 pm
Subject: Re: The D Programming Language (was: Still more new operators)

In article <1988Feb25.202237.8...@utzoo.uucp> he...@utzoo.uucp (Henry Spencer) writes:
>Most machines cannot handle bits with anywhere near the efficiency
>with which they handle bytes; the appropriate base unit for efficient code
>*is* the byte.

Be careful; cause and effect are circular here.  I've been contacted by
more than one computer architect who wanted bit addressability but had
trouble convincing management to accept the slightly added expense because
they would observe that such a facility could not be exploited from popular
high-level languages.  In fact, I have many applications for bit arrays
and bit maps, and there is a severe performance penalty caused by lack of
hardware support for them (and high-level language access to such support).

My "short char" proposal did not REQUIRE bit addressability, but it did
allow it to be exploited if the implementor decided it was wanted.
(1 = sizeof(short char) <= sizeof(char).)  The other main implementation
would be to let a "short char" be an 8-bit byte and a normal "char" be
big enough to hold an entire textual unit (typically 16 bits in Japan).
Unfortunately not many committee members seem to be bit-map programmers...

>Please explain how avoiding superfluous words and keeping necessary ones
>short is consistent with changing {/} to begin/end for no particular reason.

A better reason for a change here is the problems cause by "dangling else"
and accidental ";" after the closing ")" of a while().  The idea that such
clauses control a single statement (which might be a compound statement)
makes C susceptible to such errors; using unique bracketing keywords would
be safer.
        while condition do ;-separated_statements done
        if condition then ;-separated_statements else ;-separated_statements fi
If would also be nice if such statements could return values (so ?: could
be dispensed with).  Better yet, adopt notation more supportive of concurrent
processing, such as Dijkstra's "guarded" commands.  Why not support the future?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Gwyn  
View profile  
 More options Feb 27 1988, 7:49 pm
Newsgroups: comp.lang.c
From: g...@brl-smoke.ARPA (Doug Gwyn )
Date: 28 Feb 88 00:49:01 GMT
Local: Sat, Feb 27 1988 7:49 pm
Subject: Re: The D Programming Language (was: Still more new operators)

In article <1...@maccs.UUCP> gor...@maccs.UUCP (gordan) writes:
>... defaulting to int.  _Has_ this been changed in ANSI C?

No, like other warts, since this is widely used in correctly-written
(according to K&R rules) C code, and since it does not pose any true
technical problems, it must continue to be tolerated.  Fix it in "D".

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "labelled blocks" by a...@alice.uucp
ark  
View profile  
 More options Feb 28 1988, 9:16 pm
Newsgroups: comp.lang.c
From: a...@alice.UUCP
Date: 29 Feb 88 02:16:50 GMT
Local: Sun, Feb 28 1988 9:16 pm
Subject: labelled blocks
The best scheme I've seen for labelled blocks comes from SETL.
In SETL, statements like `IF' and `WHILE' begin blocks which
must be ended by `END' statements.  Thus one can write:

        IF x > y
        THEN    max := x;
        ELSE    max := y;
        END;

(I think I have the semicolons right; I'm sure about the one after END)

When these structures are nested deeply, one may be confused about
just what is being ended.  To reduce confusion, the programmer may
insert any number of tokens from the opening statement between the
END and the semicolon:

        IF x > y
        THEN    max := x;
        ELSE    max := y;
        END IF x > y;

These tokens are optional, but if they appear, they must match
the corresponding tokens from the opening statement.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language, labelled blocks" by ralf.br...@b.gp.cs.cmu.edu
ralf.brown  
View profile  
 More options Feb 29 1988, 8:06 am
Newsgroups: comp.lang.c
From: Ralf.Br...@B.GP.CS.CMU.EDU
Date: 29 Feb 88 13:06:01 GMT
Local: Mon, Feb 29 1988 8:06 am
Subject: Re: The D Programming Language, labelled blocks

In article <24...@cca.CCA.COM>, g...@cca.CCA.COM (Richard Harter) writes:
}As a side point, I like the suggestion that someone made that there be
}a fallthrough statement rather than automatic fallthrough.

So, you would like to have to write
        switch(var)
           {
           case foo: fallthrough;
           case bar: fallthrough;
           case baz: fallthrough;
           case mung: /* code to do something for all four cases */
           }
?

Or add yet another special case (automatic fallthrough if and only if there
is no code between the two labels)?

--
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school)
ARPA: R...@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make.
FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler
BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language" by Guy Middleton
Guy Middleton  
View profile  
 More options Feb 29 1988, 1:27 pm
Newsgroups: comp.lang.c
From: gamiddle...@watmath.waterloo.edu (Guy Middleton)
Date: 29 Feb 88 18:27:07 GMT
Local: Mon, Feb 29 1988 1:27 pm
Subject: Re: The D Programming Language

In article <24...@cca.CCA.COM> g...@CCA.CCA.COM.UUCP (Richard Harter) writes:
> In article <7...@cresswell.quintus.UUCP> o...@quintus.UUCP (Richard A. O'Keefe) writes:
> >In article <24...@cca.CCA.COM>, g...@cca.CCA.COM (Richard Harter) writes:
> >> Here is an alternative to endif et al.  Use labels to start blocks and
> >> 'end labels' to end them....

> >He has just re-invented BCPL.

There is another thing that should be reintroduced:  case ranges in switch
statements.  These were part of B (although they were not in BCPL):

        switch (x) {
            case <0: /* ... */
                break;
            case 0::10: /* ... */
                break;
            case >10:        /* ... */
            default:
        }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "bitsize() operator (was: The D Programming Language)" by John Stanley
John Stanley  
View profile  
 More options Feb 29 1988, 3:28 pm
Newsgroups: comp.lang.c
From: j...@viper.Lynx.MN.Org (John Stanley)
Date: 29 Feb 88 20:28:49 GMT
Local: Mon, Feb 29 1988 3:28 pm
Subject: bitsize() operator (was: The D Programming Language)

 >> Another thing that should go is the assumption that the unit of storage is
 >> the byte.  The base unit of storage is the bit, and sizeof should return the
 >> number of bits in the object.  This enables to treat objects smaller than a
 >> byte as first class objects.

  While I'm totaly against changing the existing functionality of the
sizeof() operator, what I would be totaly in favor of would be the
addition-to-ansi-C of a new operator that would have a similar
functionality, but which would return the number of -bits- in
something.  The name bitsize() would be my suggested name for this
operator.

  This would provide one MAJOR advantage.  It would allow writing code
or header files that would be 100% portable without having to know
about each and every compiler/OS/machine's identifer defines.  If you
needed a 12 bit integer type, your headers could have #if statements
that would provide the next integer type equal or larger that 12 bits.
No more #ifdef'ing special integer types individualy for each system
when you're trying to make efficient code run on multiple machines.

  An additional minor advantage would be the capability of writing
the kinds of functions we normaly use sizeof for to work with bitfield
variables..

  This is a relatively minor addition to any existing compiler
(multiply sizeof by 8 for most machines... and return the bitsize
that's probably already a field in the evaluation structure for a
bitfield variable...) and would make some major advancements possible
in source code portability...

  Doug Gwyn, I'd appreceate hearing your reaction on this suggestion.
If it's never come up as a suggestion, feel free to play with it.  If
it's been considered and rejected, I'd like to hear the reasoning
behind the rejection.  

---
John Stanley (j...@viper.UUCP)
Software Consultant - DynaSoft Systems
UUCP: ...{amdahl,ihnp4,rutgers}!meccts!viper!john


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language" by Jonathan Leffler
Jonathan Leffler  
View profile  
 More options Feb 29 1988, 4:08 pm
Newsgroups: comp.lang.c
From: j...@riddle.UUCP (Jonathan Leffler)
Date: 29 Feb 88 21:08:59 GMT
Local: Mon, Feb 29 1988 4:08 pm
Subject: Re: The D Programming Language

In article <6...@iuvax.UUCP> c...@iuvax.UUCP (Charles Daffinger) writes:
>I think the language you want was already designed by Nicolas Wirth:  Pascal.

More likely: Modula-2

After all, that was what Wirth intended to design when he designed Pascal.

#include <disclaimer.h>
Jonathan Leffler (j...@sphinx.co.uk)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank Adams  
View profile  
 More options Feb 29 1988, 6:07 pm
Newsgroups: comp.lang.c
From: fra...@mmintl.UUCP (Frank Adams)
Date: 29 Feb 88 23:07:47 GMT
Local: Mon, Feb 29 1988 6:07 pm
Subject: Re: The D Programming Language
In article <24...@cca.CCA.COM> g...@CCA.CCA.COM.UUCP (Richard Harter) writes:

|       if (boolean expression)
|               ....
|               end
|       else
|               ....
|               end

Note that this does *not* solve the dangling else problem.  That being the
case, I see no reason to prefer it to the current syntax.
--

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language (was: Still more new operators)" by Frank Adams
Frank Adams  
View profile  
 More options Feb 29 1988, 6:40 pm
Newsgroups: comp.lang.c
From: fra...@mmintl.UUCP (Frank Adams)
Date: 29 Feb 88 23:40:56 GMT
Local: Mon, Feb 29 1988 6:40 pm
Subject: Re: The D Programming Language (was: Still more new operators)

In article <1988Feb25.202237.8...@utzoo.uucp> he...@utzoo.uucp (Henry Spencer) writes:
>> ... An undeclared variable should be an error, not an int.

>Um, perhaps you should learn C before you start designing D...?  An
>undeclared variable *is* an error.

Mea culpa.  The C compilers I use give warnings for undeclared functions and
several other things, which I treat as errors; so sometimes I forget which
ones are really errors.

The point still stands as regards undeclared functions, though.

>> Another thing that should go is the assumption that the unit of storage is
>> the byte.  The base unit of storage is the bit, and sizeof should return the
>> number of bits in the object.  This enables to treat objects smaller than a
>> byte as first class objects.

>Here we have a key decision:  is D to share C's emphasis on generation
>of efficient code?

Yes.

>If so, then trying to forget that bytes exist is a serious
>mistake.  Most machines cannot handle bits with anywhere near the efficiency
>with which they handle bytes; the appropriate base unit for efficient code
>*is* the byte.

This makes C nicely efficient on *many* machines; but there are others on
which a larger size would be much better.  Not every machine is byte
addressable.

Conversely, on those machines which *do* have bit addressing, C provides
very inefficient access to it.

We need to figure out how to make D efficient without regard to the
addressing unit of the machine.  Off-hand, I'm not sure how to do that.

>> ... In keeping with the spirit of C, we avoid
>> superfluous words, and keep the ones we do use short.

>> With these changes, the {} statement delimiters become much less useful.  I
>> would probably drop them, and add a "begin ... end;" construct...

>Please explain how avoiding superfluous words and keeping necessary ones
>short is consistent with changing {/} to begin/end for no particular reason.

I was thinking that with the other changes I proposed, the compound
statement would be needed only for declaring variables local to part of a
function.  This use is not important enough to justify allocating two special
symbols to it.

This overlooks the compound statement forming the body of the function.  This
is easily enough dealt with by making the function syntax be:
        type declarator declarations statements end ;
instead of
        type declarator { declarations statements }

One possible use for the braces would be as type parentheses, so one could
write:
        {int *} a, b;
to make both a and b pointers to int.  I think using this for casts would
improve readability as well.  (That is, replace the parentheses around the
cast type with braces.)

This is an off-the-cuff idea, there may be better ones.

>> do we really need the pre-processor any more? ...

>The C++ people claim that the answer is "not much", given inline functions
>in particular.  They do still use it for some specialized problems, though.

Overall, the preprocessor seems to be used as a way to hack prototypes for
the next extension to the language.  C++ people tend to use it for
parameterized types, early C used it for consts and enums, etc.  This may be
an argument for keeping it.

>> I would omit the automatic insertion of a null byte at the end of character
>> constants.  If you want nul terminated strings, write the nul.  If you want
>> strings with counts, the language should not get in your way.

>Pray tell, how do you write a counted-string constant?

struct string {char * data; int size};
char dummy[] = "This is my string."
struct string s = {&dummy, sizeof(dummy)};

If you want the length immediately preceding the string, you need new syntax
and/or the pre-processor to avoid writing the string twice.

>I would suggest that "abc" should mean a length-3 string with any necessary
>terminator, regardless of what flavor of string is in use.  That way you get
>a choice, without recoding all your string constants.

And how do you specify what flavor of string is "is use?".
--

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Portable "asm" (Was: The D Programming Language)" by Frank Adams
Frank Adams  
View profile  
 More options Feb 29 1988, 6:46 pm
Newsgroups: comp.lang.c
From: fra...@mmintl.UUCP (Frank Adams)
Date: 29 Feb 88 23:46:24 GMT
Local: Mon, Feb 29 1988 6:46 pm
Subject: Re: Portable "asm" (Was: The D Programming Language)
Clearly, assembler statements should have been defined as:

#asm <statement>

instead of

asm("statement");

This is almost worth doing in C; I would certainly do it in D (assuming the
preprocessor is kept).
--

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language (was: Still more new operators)" by Dave Decot
Dave Decot  
View profile  
 More options Feb 29 1988, 10:45 pm
Newsgroups: comp.lang.c
From: de...@hpisod2.HP.COM (Dave Decot)
Date: 1 Mar 88 03:45:27 GMT
Local: Mon, Feb 29 1988 10:45 pm
Subject: Re: The D Programming Language (was: Still more new operators)
Array first-class-ness and aggregate constants could be easily provided
within C (not that I want to discourage D-zigners; it's a meritorious idea).

The basic ideas are that "a[]" is an array lvalue, and that aggregate
constants are natively typeless and must always be either cast or assigned
to the appropriate type.  Two examples follow.

(Watch out for the extensions to printf(3S) and scanf(3S) for array handling.)

I will explain any of this if desired.

EXAMPLE 1

    int thing(i, a, b)[2]
    int i, a[2], b[2];
    {
       int val[2];

       val[0] = a[i] - b[0];
       val[1] = a[i] - b[1];

       return (val[]);
    }

    main()
    {
        typedef int PAIR[2];

        char *message = "END-OF-EXAMPLE";

            PAIR p1, p2, p3[2];

            p1[] = {2, -3};
            printf(p1: "%(2)4d\n", p1);

            p2[] = {1, 7};
            printf("p2: %(2)4d\n\n", p2);

            p3[0][] = thing(0, p1[], p2[]);
            p3[1][] = thing(1, p1[], (PAIR) {1, 7});

            printf("p3: %(2;  )(2, )d\n\n", p3);

            printf("%(* )c\n", strlen(message), message);
            printf("%(*:-])c\n", strlen(message)*2/3, (char *)NULL);
    }

prints

    p1:    2  -3
    p2:    1   7

    p3: 1, -5;  -4, -10

    E N D - O F - E X A M P L E
    :-]:-]:-]:-]:-]:-]:-]:-]:-]

ANOTHER EXAMPLE

main()
{
    int array[10][10];
    int array2[100][10] = {0};      /* fills entire auto array with 0s */
    int row;

        scanf("%(10 )(10 )d", array);  /* reads free-format 10x10 array */

    /* copy array into top 10 rows of array2 */
        for (row = 0; row < 10; row++)
            array2[row][] = (int [100]) array[row][];   /* cast is not needed */

        reduce( (int [100][100]) array2[], 10);      /* this cast is required */

        for (row = 0; row < 10; row++)               /* copy the rows back */
            array[row][] = array2[row][];

        printf("%(10\n)(10 )6d\n", array);    /* display square array */

}

reduce(a, n)
int a[100][100];
int n;
{
    /* ... */


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barnacle Wes  
View profile  
 More options Mar 1 1988, 1:39 am
Newsgroups: comp.lang.c
From: w...@obie.UUCP (Barnacle Wes)
Date: 1 Mar 88 06:39:45 GMT
Local: Tues, Mar 1 1988 1:39 am
Subject: Re: The D Programming Language (was: Still more new operators)
Frank, if you want to write your programs in Ada, write them in Ada.
Don't try to re-write a C compiler to accept Ada programs.  In fact,
you should re-post this message in comp.lang.ada, I think you'd find a
more receptive audience there.  Since the name Ada has already been
used, and your language is sufficiently different from C to NOT name
it D, perhaps you could call it "DoD".  But that's been used, too,
hasn't it?

        (-: :-)         (-: :-)         (-: :-)

--
    /\              -  "Against Stupidity,  -    {backbones}!
   /\/\  .    /\    -  The Gods Themselves  -  utah-cs!utah-gr!
  /    \/ \/\/  \   -   Contend in Vain."   -  uplherc!sp7040!
 / U i n T e c h \  -       Schiller        -     obie!wes


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "The D Programming Language" by Dave Sill
Dave Sill  
View profile  
 More options Mar 1 1988, 1:23 pm
Newsgroups: comp.lang.c
From: ds...@NSWC-OAS.arpa (Dave Sill)
Date: 1 Mar 88 18:23:13 GMT
Local: Tues, Mar 1 1988 1:23 pm
Subject: Re: The D Programming Language

In article <225800...@uxe.cso.uiuc.edu> mcdon...@uxe.cso.uiuc.EDU writes:
>I find it hard to believe that a successor to C is needed or would be
>appreciated.

Yes, C is adequate for most of today's needs.  But it does have its
problems and weaknesses.  If we want to have a language to take its
place tomorrow, we had better start thinking about it today, though.

>I come to this as a former 100% Fortran (and assembler)
>programmer who now uses C about 80 % of the time. C does have a few,
>minor defects (for instance, I will never , ever understand the syntax
>of declarations; I have had a guru make up a huge chart listing dozens of
>them, which I carry in my wallet.) So does every other language.

To varying degrees.  Hopefully D will learn from C, and at least not
repeat the same mistakes.

>C does
>one thing extremely well: convert the heart of the machine operations of
>a byte-addressible, conventional processor (i.e. the PDP11) into a nice
>higher language.

Certainly an appropriate behavior for a systems programming language
designed in the early seventies.  But D should be targeted to a more
general purpose, as C is being used today.  Also, D should be more
adaptable to unconventional processors than C is.  E.g., it should be
more suitable for parallel processing environments.

>It is pleasantly compact, and very full of nice
>shortcuts (e.g. "string"[i] ). If you dislike C , try other languages:
>Fortran, Pascal, Ada ,Modula 2. Me, well , I like C and Fortran and loathe
>the rest.

D would not be for people who dislike C.  It would be for people who
like C but find it lacking by today's standards in certain areas.

>But if a new language is to be designed, and done really well, it
>won't be done by committee. For the perfect example look in comp.lang.fortran
>and read about 88tran, the totally new language with two heads, brought
>to you by X3J3.

We aren't designing D here.  We are pointing out those things lacking
in C that we'd like to see done right in a currently hypothetical
successor.  Of course if somebody wanted to digest our discussions,
design a language based on them, implement a compiler (perhaps based
on GNU C or C++), call it D, and distribute it freely, I wouldn't
complain.

=========
The opinions expressed above are mine.

"The limits of my language mean the limits of my world."
                                        -- Ludwig Wittgenstein


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Sill  
View profile  
 More options Mar 1 1988, 3:03 pm
Newsgroups: comp.lang.c
From: ds...@NSWC-OAS.arpa (Dave Sill)
Date: 1 Mar 88 20:03:10 GMT
Local: Tues, Mar 1 1988 3:03 pm
Subject: The D Programming Language
(Not really a C issue)

Am I the only person in the world that thinks it's time to scrap
ASCII?

Look at the contortions we have to go through in C because there
aren't really enough characters for the operators needed.  Look at the
messes we get into under the UNIX shells with quote characters,
delimiters, et cetera.  Wouldn't it be simpler if punctuation was
punctuation and metacharacters were metacharacters and there was no
overlap between the two?

APL, of course, solved this problem by inventing its own character
set.  Unfortunately, it was nonstandard and there was almost no
equipment that used that character set.

The time is ripe for a more flexible "Code for Information
Interchange".  How many more years/decades will we be forced to make
do with a lousy 95 symbols: all predefined, most vastly overloaded?

C would have been much more usable language if it hadn't had to have
been mapped to ASCII.  D could be the best of C and APL if a larger
character set was available.

I know, I know, the cost of such a change would be phenomonal.  Even
deciding on a new standard will be hard/expensive/time-consuming, but
it's *got* to be done sooner or later.  (Not until we've lived with
several incompatible proprietary systems for a while, though.)

I just needed to get that off my chest, sorry if I bothered you.

=========
The opinions expressed above are mine.

"There is very little importance in instruction sets."
                                        -- Ted Nelson

"There is very much importance in character sets."
                                        -- Me


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Gwyn  
View profile  
 More options Mar 1 1988, 4:43 pm
Newsgroups: comp.lang.c
From: g...@brl-smoke.ARPA (Doug Gwyn )
Date: 1 Mar 88 21:43:11 GMT
Local: Tues, Mar 1 1988 4:43 pm
Subject: Re: The D Programming Language

In article <12...@brl-adm.ARPA> ds...@NSWC-OAS.arpa (Dave Sill) writes:
>The time is ripe for a more flexible "Code for Information
>Interchange".  How many more years/decades will we be forced to make
>do with a lousy 95 symbols: all predefined, most vastly overloaded?

ISO extended the character set several years ago.  It has also been
extended (in more than one way) to accommodate Kanji characters.
C source can be in EBCDIC (for example); it seems inappropriate to
require either a specific character code "standard", or an even
larger set of characters than it already uses, given the amount of
trouble with this we've already had.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 26 - 50 of 196 < Older  Newer >
« Back to Discussions « Newer topic     Older topic »