Re: More feature requests, or is it syntax?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jacques Guy wrote:

> initialize a large number of local variables by hand.

For a language the *requires* that variables be initialized before use, =
I always though not allowing declaration during initialization rather =
odd and occasionally irritating.

I'd love to have it.

> dic=3DdicAddItem(dic,thisWord)

I almost always end up assigning a global variable in these instances, =
and calling a procedure like:

   dicAddItem( thisWord )

I've almost gotten used to only passing by value, but it's a hard habit =
to break. But somewhere in my heart, I suspect the discipline of doing =
without passing by reference is a Good Thing, and makes my code better.

> *only* the first parameter is called by reference

Yeah, there are many times when I've written something using the form:

   variable =3D function( variable, value )

such as:

   a =3D a + 1
   s =3D append( s, "foo" )
   dictionary =3D addDictionary( dictionary, word )

when I've wondered if there were a better syntax for it. In PP, there =
are a number of tools, similar to the +=3D in C:

   a =3D+ 1      -- a =3D a + 1
   s =3Da "foo"  -- s =3D append( s, "foo" )
   s =3D& "foo"  -- s =3D s & "foo"

but they've always struck me as too C-like (read: terse and cryptic) to =
be acceptable. I've played with a number of syntax options with PP in =
mind, such as:

   dictionary =3D addDictionary( self, "foo" )

or in the other direction:

   self =3D addDictionary( [dictionary], "foo" )

Here, the [braces] make it easier to parse the value of 'self'); or even =
just:

   self =3D addDictionary( dictionary, "foo" )

where the first argument of the function is assumed to be the value of =
'self'.

These would work for a program like PP, or macro expansion. The 'self' =
keyword isn't half bad, but it lacks the kind of inspired elegance I'd =
like to see in a solution.=20

Even worse is the the proc_id version:

   dictionary =3D self( "addDictionary", { "foo" } )

Be afraid.=20

I'd love to see a suggestion where this syntax was handled elegantly, =
without passing by reference. As it stands, the cure seems much worse =
than the disease.

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu