[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: what's the return value of kjs-functions that appear to be void?
From: Harri Porten <porten () trolltech ! com>
Date: 2001-07-28 13:29:41
[Download RAW message or body]
On Sat, 28 Jul 2001, Tobias Anton wrote:
> for the following patch, we're not sure about the result of the function:
>
> @@ -1074,8 +1074,9 @@ Completion WindowFunc::tryExecute(const
> case Focus:
> - result = Undefined();
> - // TODO
> + if (widget)
> + widget->setActiveWindow();
> + return Completion(Normal);
> break;
>
> should it rather be Undefined()?
> + result = Undefined();
> and later:
> return Completion(ReturnValue, result);
Yes. Assuming focus() doesn't return anything.
> What's the difference in the meaning of:
> Completion(Normal);
> and:
> Completion(ReturnValue, Undefined());
The first denotes leaving a function body without a return, break,
continue or throw statement. The later should be used when you want to
mimmick a simple return; (or return undefined;) statement.
The completion type is checked after a statement is executed and can lead
to e.g. abortion of execution or a different reaction on using a function
as constructor via 'new'.
The difference between a *undefined* ReturnValue completion or a Normal
completion is not so big, though.
> If the first is the Case, it would need to be changed in manymany places in
> kjs_window and probably elsewhere.
Where for example ? Note that completions are only used in ::execute()
functions (tryExecute() here). get() and put() just return simple values
or Undefined() if none.
Harri.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic