🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Paul Moore Wed, 12 Dec 1990 12:26
default value specifications
#632
Author: Paul Moore
Date: Wed, 12 Dec 1990 12:26
27 lines
1415 bytes
Has anybody proposed a feature to allow more control over the use of
default values in function specifications?

The area I am trying to address is as follows:-

    funca(int i,int j,int k=1, int l=1)

With this syntax is is possible to invoke funca with both k and l not given,
and with l not given, but it is not possible to invoke funca giving l
but not k.

I can imagine several syntaxes that would allow this to be performed

	funca(1,2,,3);
	funca(1,2,*,3);  // or some other character
	funca(1,2, l=3);

The last one is a more fundamental change as it requires knowledge of the
data names used in the function definition. There are some C implementations
that allow the complete use of parameter association by name rather than
position (taken from ADA I think), a discussion of the usefulness of that
construct should not take place here, although it's not an unreasonable
discussion to have.

My preference is for the first construct as it seems the most natural and
does not involve adding any extra meaning to any tokens, or defining new
tokens.
Re: default value specifications
#633
Author: Antony Hodgson
Date: Wed, 12 Dec 1990 15:15
22 lines
1303 bytes
In article <1990Dec12.122646.13874@hemel.bull.co.uk> pmoore@hemel.bull.co.uk (Paul Moore) writes:

>[Given:]    funca(int i,int j,int k=1, int l=1)

Could we use a syntax like one of the following to allow us to specify l,
but not k?
>
>	funca(1,2,,3);
>	funca(1,2,*,3);  // or some other character
>	funca(1,2, l=3);
>
>My preference is for the first construct as it seems the most natural and
>does not involve adding any extra meaning to any tokens, or defining new
>tokens.

I would also find this a useful feature, and although I agree that the
first construct is the most "natural", I think I would prefer to use some
character (like _ in Prolog) to call attention to the fact that you are
accepting the default.

Tony Hodgson
ahodgson@hstbme.mit.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads