[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Shorthand for appending to a table (was Re: 5.2 feature list?)
- From: "Kucera, Rich" <Kucerar@...>
- Date: Tue, 12 Sep 2006 10:09:55 -0400
> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] On Behalf Of David Given
> Eric Scouten wrote:
> [...]
> > tableWithMeaningfulName[] = value
>
> I have to say that I don't like this, simply because the syntax doesn't
> convey
> any information about what it does --- if anything, it looks like it
> should
> assign to *all* members of the table. I'd rather have the language
> consistent
> and verbose rather than concise and full of special exceptions. That way
> lies
> madness, e.g. Perl.
I think the search is for a meaningful syntax that does something, does some
work, and the madness to be avoided is a syntax that does nothing, for
example:
void convertToDisplayValues( HashMap recordForView ) {
Iterator iter = recordForView.keySet().iterator();
while ( iter.hasNext() ) {
String fieldName = (String)iter.next();
if ( ((String)recordForView.get(fieldName)).equals("on") ) {
recordForView.put(fieldName, "*** ADD ***");
}
...
The same thing in PHP actually starts to reveal some meaning, do some work:
function convertToDisplayValues( $recordForView ) {
foreach ( $recordForView as $fieldName => $fieldVal ) {
if ( $fieldVal == "on" ) {
$recordForView[$fieldName] = "*** ADD ***";
}
...
Probably the same thing in Python would be even more concise. I don't know
what this blurb would look like in Lua because I haven't written any Lua yet
:-) ...Can someone please?
Best Regards,
-R