All of this "Wrapping" into "tuple" objects - either into dictonaries,
classes or using structs ?? Just for what might merely be the need to return
two integers ??   its an awful lot of unnecessary tedious activity - both on
the part of us as programmers and the CPU - for what could be a very simple
requirement. 

All the alternatives  (asides maybe ByRef )  really are overkill. For what
is a really simple need. The need to define more than one return value on a
clear and readable and unambiguous fashion.  ByRef is not unambiguous.

Now of course RB could implement this FR internally by wrapping the two
integers inside a "hidden" struct.  This would nicely avoid us having to
define such a struct ourselves, cluttering the project editor with endless
tiny structs and classes.


On 24/3/07 22:42, "Norman Palardy" <[EMAIL PROTECTED]>
wrote:

> 
> On Mar 24, 2007, at 2:58 PM, Dr Gerard Hammond wrote:
> 
>> I couldn't agree more John. The speed of dictionaries is great but
>> the syntax is awfully confusing.
>> 
>> I am forever going back to working version of dictionary code to copy
>> and paste.
>> For some reason, the current syntax just never makes sense to me.
>> 
>> Maybe we should fix this ourselves, using the 'extends' keyword to
>> modify the dictionary object syntax. (It might even show us why the
>> syntax is the way it is?)
> 
> A simple wrapping of a dictionary into a "tuple" can be pretty quick
> and painless
> 
> 1) create a new class called Tuple
> 2) add a private property as Dictionary (call it mProperties)
> 3) add a Constructor with this code
> 
> mProperties = new Dictionary
> 
> 4) define the operator_lookup method that takes a string parameter
> called name and returns a variant with this code
> 
> operator_lookup(name as string) as variant
> 
> if mProperties.hasKey(name) then
> return mProperties.value(name)
> else
> return "" // that return 0 as assignment to a string will give "0"
> end if
> 
> 5) add a method for adding values. This is also an operator_lookup
> method but ASSIGNS a variant
> 
> operator_lookup(name as string, assigns v as variant)
> 
> mProperties.value(name) = v
> 
> 
> At this point in your code you can do
> 
>    dim t as tuple
> 
>    t = new Tuple
>    t.i = 123
>    t.s = "456"
> 
>    dim i as integer
>    dim s as string
> 
>    i = t.i
>    s = t.s
> 
> Of course you could also do
> 
>    s = t.i
>    i = t.s
> 
> And you would get whatever coercions from one type to another that
> variants already perform
> 
> IF there were some way to provide type safety that would be good :)
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> 
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
> 

Regards,

Dan

_______________________________________________________
www.13flatFIVE.com
The C++ <> REALbasic code migration specialists


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to