Przemyslaw,

Przemysław Czerpak wrote:

> We have some initial code used for class declaration and strong typing but
> it was never fully functional.

Do we need strong typing to spot undeclared variables?

> The last part is casting and here we probably have the biggest problem.
> Now it's possible to use
>     <exp> AS <type>
> i.e.:
> 
>    func f( x as usual ) as string
>       if valtype( x ) == "N"
>          x := str( x as numeric )
>       elseif valtype( x ) != "C"
>          x := ""
>       endif
>    return x as string
> 
What's the need to write

x := str( x as numeric )

given that I'm calling str? It seems to me just a waste of typing, even more
so given the previous valtype which confirms it is a number.

> other method is using some new operator which will work well with PP.
> I.e. instead of 'AS' we can use '.AS.' because expressions like
> <exp> .AS. <type> are recognized by PP s single expression, i.e.
> 
>    ? x .as. numeric
> 
> is well preprocessed by PP to:
> 
>    QOUT( x .as. numeric )
> 
I really don't like this solution, .Something. operators are logical for me,
while this one would be different.

I'd say, what about

x:toNumber()

to treat it like an (implicit) object?

Maurilio.

-- 
 __________
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.


_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to