Board index » delphi » Re: Language Features I would Like To See

Re: Language Features I would Like To See


2005-03-10 07:42:41 PM
delphi222
John Kaster (Borland) writes:
Quote
Rudy Velthuis [TeamB] writes:

>LOL! You could've said <AOL>instead. <g>

Wow, people on AOL are now saying "Yeah, what Nick said"?!?!

Nick, your reach has exceeded your grasp.
<sigh><rolls eyes>Americans!
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"I think 'Hail to the Chief' has a nice ring to it."
- John F. Kennedy (1917-1963) when asked what is his favorite song
 
 

Re: Language Features I would Like To See

David Smith writes:
Quote
If you people want that kind of syntax, there are plenty of C-languages.
I can imagine you objecting to the introduction of object extensions
into TP "If you want OO, use Samlltalk."
 

Re: Language Features I would Like To See

David Smith writes:
Quote
>can be reduced to--
>
>Row := (Table.RowExists(R)) ? Table.GetRow(R) : Table.NewRow(R);

That's horrible! The code is unreadable.
Not really, but very un-Delphi. I would prefer Algol-style:
Row := if (Tabe.RowExists(R) then Table.GetRow(R) else
Table.NewRow(R);
So instead of
if (index < 0) or (count < 0) then
begin
if index < 0 then
Str := 'index'
else
Str := 'count';
raise ArgumentOutOfRangeException.Create(Str, StrArgOutOfRange);
end;
You would get:
if (index < 0) or (count < 0) then
raise ArgumentOutOfRangeException.Create(
if index < 0 then 'index' else 'count', StrArgOutOfRange);
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"When you hear hoofbeats, think of horses, not zebras."
-- Old saying
 

Re: Language Features I would Like To See

Rudy Velthuis [TeamB] writes:
Quote
>>Row := (Table.RowExists(R)) ? Table.GetRow(R) : Table.NewRow(R);
>
>That's horrible! The code is unreadable.
:P I find it quite readable, but then I suppose Im used to it.
Quote
Row := if (Tabe.RowExists(R) then Table.GetRow(R) else
Table.NewRow(R);
Mabye a kinda compromise..
Row := if(table.rowexists(r),table.getrow(r),table.newrow(r));
which you could arguably make now.
 

Re: Language Features I would Like To See

Or you can use strutils.IfThen():
if (index < 0) or (count < 0) then
raise ArgumentOutOfRangeException.Create(
IfThen(index < 0, 'index', 'count'), StrArgOutOfRange);
"Rudy Velthuis [TeamB]" <XXXX@XXXXX.COM>writes
Quote

if (index < 0) or (count < 0) then
raise ArgumentOutOfRangeException.Create(
if index < 0 then 'index' else 'count', StrArgOutOfRange);

 

Re: Language Features I would Like To See

John Kaster (Borland) writes:
Quote
>Allright. How about QC#11274 ?

Great first cut. Let's see what kind of comments you get.
It's got my vote, especially the strings case..
 

Re: Language Features I would Like To See

Quote
I can imagine you objecting to the introduction of object extensions
into TP "If you want OO, use Samlltalk."
He was talking about syntax, not semantics :-)
Cheers,
Jim Cooper
__________________________________________
Jim Cooper XXXX@XXXXX.COM
Tabdee Ltd www.tabdee.ltd.uk
TurboSync - Connecting Delphi to your Palm
__________________________________________
 

Re: Language Features I would Like To See

Quote
which you could arguably make now.
No need, it is already there - see IfThen :-)
Cheers,
Jim Cooper
__________________________________________
Jim Cooper XXXX@XXXXX.COM
Tabdee Ltd www.tabdee.ltd.uk
TurboSync - Connecting Delphi to your Palm
__________________________________________
 

Re: Language Features I would Like To See

Quote
Iman L Crawford in <XXXX@XXXXX.COM>writes:
Jim Cooper <XXXX@XXXXX.COM>wrote in news:422f37e5
@newsgroups.borland.com:
>But the worst offenders are those who nest the damn things. It starts to
>look like an Excel formula :-)

or nested with statements. All syntactical sugar has the ability to
obfuscate code.
I don't like with statements, people who use nested with statements should
be boiled in oil and forced to use Win 3.1. :)
 

Re: Language Features I would Like To See

Hallvard Vassbotn writes:
Quote
In a way I feel that dynamic arrays is often the wrong, non-OOP
solution to the typed container problem. Once we have generics in
place, we should probably use TList<Integer>etc. instead and then we
get the capacity, and efficient growing for "free".
I agree. In Win32, I really only use dynamic arrays for PODs; I write
a type-safe list wrapper for objects.
In .NET 1.1 there is a performance advantage to using Array instead of
ArrayList in some cases, but that will go away with .NET 2.0 and
generics. In .NET 2.0 I doubt I will use Array even for value types. (I
don't *think* you have to deal with boxing when using either value
types or reference types and a generic list, but I am not certain.)
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
How to ask questions the smart way:
www.catb.org/~esr/faqs/smart-questions.html
 

Re: Language Features I would Like To See

Will DeWitt Jr. writes:
Quote
Also, FWIW, it doesn't always obfuscate the code-- often times
it's more readable due to the ability to have everything fit on
one line. Can it lead to obfuscated code? Sure, but so can a lot
of other things.
I often intentionally split things up into multiple lines, when
they "could fit" on one line. it is a lot easier to work the
de{*word*81} when you've got a then/else statement separated out for
the de{*word*81} to stop on, instead of trying to watch/evaluate
everything.
-Brion
 

Re: Language Features I would Like To See

Will DeWitt Jr. writes:
Quote

Also, FWIW, it doesn't always obfuscate the code-- often times it's
more readable due to the ability to have everything fit on one line.
I've never been a big believer in the "reduce lines of code to
allegedly make it more readable" school of thought.
--
Nick Hodges -- TeamB
Lemanix Corporation -- www.lemanix.com
Read my Blog -- www.lemanix.com/nick
 

Re: Language Features I would Like To See

Don Strenczewilk writes:
Quote
Or you can use strutils.IfThen():
No, in many cases, as was discussed here already, you can't. Both
branches are evaluated before they are passed to IfThen, and that is
not what we want, since you don't want to run NewRow if the row exists.
For some cases, IfThen is a possibility indeed.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"A low voter turnout is an indication of fewer people going to the
polls."
-- George W. Bush
 

Re: Language Features I would Like To See

Don Strenczewilk writes:
Quote
Or you can use strutils.IfThen():
Which doesn't work like a ternary operator does. See higher up in this
thread.
Will
--
Want native support in Delphi for AMD64/EM64T? Vote here--
qc.borland.com/wc/qcmain.aspx
 

Re: Language Features I would Like To See

Jim Cooper writes:
Quote

>which you could arguably make now.

No need, it is already there - see IfThen :-)
Which doesn't work like a ternary operator does. See higher up in this
thread.
Will
--
Want native support in Delphi for AMD64/EM64T? Vote here--
qc.borland.com/wc/qcmain.aspx