[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: KSpread tasks
From:       Ariya Hidayat <ariya () kde ! org>
Date:       2004-08-26 7:23:22
Message-ID: 412D8FEA.30401 () kde ! org
[Download RAW message or body]



> Hm, I would propose the following:
> Function f = new Function ("SIN", function_sin);
> f->addParameter (Number);
> 
> for more complex fuctions, there could be the possibility of
> f->addParameter (Any);
> meaning that no ptype checking should occur.
> 
> or even
> f->addMultiParam (String); - to allow arbitrary number of strings
> or
> f->addMultiParam (Any); - to allow anything
> 
> addParameter should also get some optional argument called "optional"
> which says whether the parameter is optional or not.

Then I can come up with some idea like:
   f->setArgument( 0, KSpreadValue::Float );

If the argument can accept an integer or a string, it could be:
   f->setArgument( 0, KSpreadValue::Integer, KSpreadValue::String );

If we do like this, we can reduce the argument information which is now
placed in the XML files (see kspread/extensions/).

> Then, function calling can look exactly as it looks now, only that the
> parser will check for parameter correctness, not the function itself.
> Maybe it doesn't look like a big win, but it will be more flexible in
> that we can convert parameters if need be, or expand arrays, if we
> decide to implement array formulas (should be easy with API like this)

I'll keep this mind.

> Also, if KSpreadValue gets some more methods like canBeString,
> canBeNumber and so, which return true if what we have can be
> meaningfully converted to a string/number/..., then we can have
> greater flexibility, when combined with asString/... being able to
> convert, say, from number to a string. But I'm getting into too much
> details I guess...

You have something like Formula::convertToString() in the new formula
parser. This is placed there because conversion sometimes need
information on the locale settings, that Value knows (and shouldn't
know) nothing about.

Best regards,

Ariya Hidayat


_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic