Hello again,
Yes indeed, i remember very well how we got in touch; was it so long ago!
Although (o)ceans' got off the ground starting october 2003 you got it
correct wondering back then what exactly i was after, some sort of
concept, framework. (o)ceans' has been preceded by another project,
mostly pure conceptual; 2002 was the time around which it finalized more
or less; the two are tangent, so matching/merging is aimed at, where i'm
heading for, but that is not directly [x]Harbour related.
To complete my previous response, here's a very basic example what is
gained with polymorphism
FUNCTION main
LOCAL c7 := "hello world"
show( c7 )
show()
RETURN nil
FUNCTION run ( o7 )
QOUT( o7:default9o( "C" ))
RETURN nil
in the character class, :default() may just return self
METHOD default9o( c7 ) CLASS character
RETURN self
and in the nil class :default9o() may be defined as
METHOD default9o ( c7 ) CLASS nil
LOCAL o7
IF c7 == "C"
o7 := ""
ELSEIF c7 == "D"
o7 := CTOD( "" )
ELSEIF c7 == "N"
o7 := 0
ELSEIF ....
....
ENDIF
RETURN o7
It is an OO approach to having arguments default according to the type they
belong to
Another example is an :eval9O() message, when implemented for both char and
array types (in my review i forgot to mention that uppercase O as type
mnemonic means 'self' )
METHOD eval9O ( b7, ... ) CLASS array
AEVAL( self, b7, ... )
RETURN self
METHOD eval9O( b7, ... ) CLASS character
LOCAL i7 // integer
FOR i7 := 1 TO LEN( self )
b7:eval9O( ::substr( i7, 1 ), ... ) // preliminary message ::substr()
NEXT
RETURN self
METHOD eval9O( ... ) CLASS block // or codeblock in Harbour?
EVAL( self, ... )
RETURN self
given an array of elements, :eval9O( b7 ) can be fired to each of them with
the very same b7 codeblock
{ "char", { 0, 1, 2 } } : eval9O( { | o7 | ;
o7:eval9O( { | o7 | QOUT( o7 ) } ) } )
result:
c
h
a
r
0
1
2
Regarding TBrowse, that isn't a function that qualifies as native type
message; generally, if the first argument to a function is of native type,
that function is a good candidate to become a message for the native type
class which that 1st argument belongs to; i saw your message asking for why
:ADD(...) didn't trigger; the answer is that although Harbour has the
structural support for native type OOP, there hasn't been any implementation
for messages yet (except for some, such as :asString()) I would strongly
recommend you to read thru the Class(y) documentation and samples regarding
native type OO support. Anton Van Straaten did an excellent job, not only
providing support for this, but also showing lucide examples iirc.
I'm thinking about a fully functional demonstration implemented in
Ca-Clipper combined with Class(y), in debugger mode, where one can see some
of the recursions, message calling etc for native type OO support in
(o)ceans' - but (o)ceans' is also kind of a complete different language,
firmly inspired by C++ - while a transpiler converts that language in pure
Ca-Clipper+Class(y), the debugger shows the (o)ceans' sourcecode, which i'd
prefer not to clutter the discussion with, since the (o)ceans' language is
not
the purpose for my intervention in this forum. I'll see what i can do about
that; stay tuned
greets,
frank
----- Original Message -----
From: "Pritpal Bedi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, December 14, 2007 9:52 PM
Subject: Re: [Harbour] CaseStudy: an alternative to Hungarian notation for
aHigh-Level language such as [x]Harbour
hence please shout if some example of practicable code needs be delivered
1) What benefits ( except from self documentation ) we can derive out of
it?
Please post a realtime function example, will be more appropriate it
Tbrowse() is taken as a modal, to understand the underlying concepts
better.
Regards
Pritpal Bedi, INDIA-USA
P.S. BTW I hear you after long time, probably since 2002.
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour