BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi 9 feature
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical
View previous topic :: View next topic  
Author Message
Max
Guest





PostPosted: Wed Sep 17, 2003 4:33 pm    Post subject: Delphi 9 feature Reply with quote




A wonderful Delphi 9 feature! Isn't it?


procedure MacroSample(APers1, APers2: TPerson);
macro
MyMacro(x)
APers1.##x := APers2.##x;
end;
begin
MyMacro(Name);
MyMacro(Firstname);
MyMacro(Age);
MyMacro(Children);
end;


Back to top
Anders Ohlsson (Borland)
Guest





PostPosted: Wed Sep 17, 2003 5:31 pm    Post subject: Re: Delphi 9 feature Reply with quote



Yuck!

Quote:
macro
MyMacro(x)
APers1.##x := APers2.##x;
end;



--
BorCon 2003 - http://www.borland.com/conf2003 - The Greatest Event Ever

Anders Ohlsson - Borland Developer Relations - http://bdn.borland.com/
Borland Software Corporation - http://www.borland.com/ - Excellence Endures
Enabling our customers to move into the future without abandoning their past
http://homepages.borland.com/aohlsson/disclaimer_ani.gif


Back to top
Alessandro Federici
Guest





PostPosted: Wed Sep 17, 2003 6:13 pm    Post subject: Re: Delphi 9 feature Reply with quote



"Max" <nospam (AT) nospam (DOT) com> wrote


Quote:
A wonderful Delphi 9 feature! Isn't it?

Useless since it's already doable in a much better way through RTTI.



Back to top
Captain Jake
Guest





PostPosted: Wed Sep 17, 2003 6:21 pm    Post subject: Re: Delphi 9 feature Reply with quote

In borland.public.delphi.non-technical, Alessandro Federici
<nomore (AT) spam (DOT) forme> wrote in message <3f68a2fa$1 (AT) newsgroups (DOT) borland.com>...
Quote:
"Max" <nospam (AT) nospam (DOT) com> wrote in message
news:3f688cd1 (AT) newsgroups (DOT) borland.com...

A wonderful Delphi 9 feature! Isn't it?

Useless since it's already doable in a much better way through RTTI.

Oh puh-LEEZE.

RTTI in Delphi only works on PUBLISHED members (and it is messier than using
macros!), but when writing assignment functions, you often want to
assign public, protected or even private members.


Back to top
John Kaster (Borland)
Guest





PostPosted: Wed Sep 17, 2003 7:17 pm    Post subject: Re: Delphi 9 feature Reply with quote

Captain Jake wrote:
Quote:
RTTI in Delphi only works on PUBLISHED members

Incorrect.


--
John Kaster, Borland Developer Relations, http://bdn.borland.com
$1280/$50K: http://homepages.borland.com/jkaster/tnt/thanks.html
Make a wish: http://qc.borland.com * Get source
http://codecentral.borland.com


Back to top
Alessandro Federici
Guest





PostPosted: Wed Sep 17, 2003 7:22 pm    Post subject: Re: Delphi 9 feature Reply with quote

"Captain Jake" <johnj[nospam]@comcast.net> wrote


Quote:
RTTI in Delphi only works on PUBLISHED members (and it is messier than
using
macros!)

Which is all he's doing anyways so my example is pertinent.

He's using a procedure and because of this only have access to public and
published stuff (the protected, accessible from inside the same unit is a
Delphi bug IMO so I won't cosider the case in which that procedure is
implemented in the unit of TPerson <G>).

Quote:
but when writing assignment functions, you often want to assign public,
protected or even private members.


published are public, so that covers it. Protected or private you don't
wanna set unless you don't care about breaking simple OO design rules. That
is exactly what properties are for.

--
Best regards,
Alessandro Federici

RemObjects Software, Inc.
http://www.remobjects.com



Back to top
Dennis Landi
Guest





PostPosted: Wed Sep 17, 2003 7:29 pm    Post subject: Re: Delphi 9 feature Reply with quote


"Captain Jake" <johnj[nospam]@comcast.net> wrote in message
Quote:
Oh puh-LEEZE.

RTTI in Delphi only works on PUBLISHED members (and it is messier than
using
macros!), but when writing assignment functions, you often want to
assign public, protected or even private members.


Check out the {$M+} compiler directive and also from the Delphi Help:

DevGuide: Creating Custom Components
Storing and loading unpublished properties


By default, only published properties are loaded and saved with a component.
However, it is possible to load and save unpublished properties. This allows
you to have persistent properties that do not appear in the Object
Inspector. It also allows components to store and load property values that
Delphi does not know how to read or write because the value of the property
is too complex. For example, the TStrings object can't rely on Delphi's
automatic behavior to store and load the strings it represents and must use
the following mechanism.

You can save unpublished properties by adding code that tells Delphi how to
load and save your property's value.

To write your own code to load and save properties, use the following steps:

1 Create methods to store and load the property value.
2 Override the DefineProperties method, passing those methods to a filer
object.





Back to top
Captain Jake
Guest





PostPosted: Wed Sep 17, 2003 8:03 pm    Post subject: Re: Delphi 9 feature Reply with quote

In borland.public.delphi.non-technical, "John Kaster (Borland)"
<johnk (AT) borland (DOT) com> wrote in message <3f68b365$1 (AT) newsgroups (DOT) borland.com>...
Quote:
Captain Jake wrote:
RTTI in Delphi only works on PUBLISHED members

Incorrect.

What? When did this change?


Back to top
Captain Jake
Guest





PostPosted: Wed Sep 17, 2003 8:09 pm    Post subject: Re: Delphi 9 feature Reply with quote

In borland.public.delphi.non-technical, Alessandro Federici
<nomore (AT) spam (DOT) forme> wrote in message <3f68b337$1 (AT) newsgroups (DOT) borland.com>...
Quote:
Protected or private you don't
wanna set unless you don't care about breaking simple OO design rules. That
is exactly what properties are for.

Hmmm...I beg to differ. When I assign one object to another I am really just
dealing with memory allocation issues. I want two copies of the same thing,
but I don't want to worry about the first one being freed before I am done
with the second. In this case I want ALL the state to cross over to the new
object, but I don't necessarily want all those state variables exposed to
*other* units. The way I view it, an assignment doesn't just
clone the external interface but the current state of the object too.


Back to top
Rudy Velthuis (TeamB)
Guest





PostPosted: Wed Sep 17, 2003 8:12 pm    Post subject: Re: Delphi 9 feature Reply with quote

Captain Jake wrote:

Quote:
In borland.public.delphi.non-technical, "John Kaster (Borland)"
[email]johnk (AT) borland (DOT) com[/email]> wrote in message
3f68b365$1 (AT) newsgroups (DOT) borland.com>... >Captain Jake wrote:
RTTI in Delphi only works on PUBLISHED members

Incorrect.

What? When did this change?

It also works on many types, like Integer or records containing string or
interfaces, etc. <g>
--
Rudy Velthuis (TeamB)

"I don't know anything about music. In my line you don't have to."
- Elvis Presley (1935-1977)

Back to top
Captain Jake
Guest





PostPosted: Wed Sep 17, 2003 8:54 pm    Post subject: Re: Delphi 9 feature Reply with quote

In borland.public.delphi.non-technical, "Yorai Aminov (TeamB)"
<yaminov (AT) delete_shorterpath (DOT) com> wrote in message
<c6lhmv8fkvfrrnua1et82qr0blrpqasgk2 (AT) 4ax (DOT) com>...
Quote:
What? When did this change?

With SOAP.

So then I have this ability in D6?


Back to top
Yorai Aminov (TeamB)
Guest





PostPosted: Wed Sep 17, 2003 9:40 pm    Post subject: Re: Delphi 9 feature Reply with quote

On Wed, 17 Sep 2003 15:03:32 -0500, "Captain Jake"
<johnj[nospam]@comcast.net> wrote:

Quote:
RTTI in Delphi only works on PUBLISHED members

Incorrect.

What? When did this change?

With SOAP.

---
Yorai Aminov (TeamB)
http://develop.shorterpath.com/yorai
(TeamB cannot answer questions received via email.)

Back to top
Captain Jake
Guest





PostPosted: Wed Sep 17, 2003 9:46 pm    Post subject: Re: Delphi 9 feature Reply with quote

In borland.public.delphi.non-technical, "Yorai Aminov (TeamB)"
<yaminov (AT) delete_shorterpath (DOT) com> wrote in message
<a8ohmv4tmq0f8hffs69a5iueub0u2ko79v (AT) 4ax (DOT) com>...
Quote:
So then I have this ability in D6?

I think so. It's not what you think, though - RTTI was extended to
support interfaces.

I thought interfaces had no private or protected members.


Back to top
Yorai Aminov (TeamB)
Guest





PostPosted: Wed Sep 17, 2003 10:33 pm    Post subject: Re: Delphi 9 feature Reply with quote

On Wed, 17 Sep 2003 15:54:49 -0500, "Captain Jake"
<johnj[nospam]@comcast.net> wrote:

Quote:
With SOAP.

So then I have this ability in D6?

I think so. It's not what you think, though - RTTI was extended to
support interfaces.

---
Yorai Aminov (TeamB)
http://develop.shorterpath.com/yorai
(TeamB cannot answer questions received via email.)

Back to top
Jim Cooper
Guest





PostPosted: Wed Sep 17, 2003 11:14 pm    Post subject: Re: Delphi 9 feature Reply with quote


Quote:
Protected or private you don't wanna set unless you don't care about
breaking simple OO design rules.

It doesn't in an Assign though, because the Assign method is part of the
definition of the class. You're free to access private and protected
things. Sometimes you have to access a private field in an assignment to
you don't trigger a setter method.

Quote:
That is exactly what properties are for.

Protected properties are useful things to have too - they aren't all
public.

Cheers,
Jim Cooper

____________________________________________

Jim Cooper [email]jcooper (AT) tabdee (DOT) ltd.uk[/email]
Tabdee Ltd http://www.tabdee.ltd.uk

TurboSync - Connecting Delphi with your Palm
____________________________________________

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.