help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: forcing function execution as a core function or from a certain pack


From: Sergei Steshenko
Subject: Re: forcing function execution as a core function or from a certain package
Date: Tue, 10 Jul 2012 12:54:22 -0700 (PDT)




----- Original Message -----
> From: Jordi Gutiérrez Hermoso <address@hidden>
> To: Sergei Steshenko <address@hidden>
> Cc: Octave users list <address@hidden>
> Sent: Tuesday, July 10, 2012 10:49 PM
> Subject: Re: forcing function execution as a core function or from a certain 
> package
> 
> On 10 July 2012 15:44, Sergei Steshenko <address@hidden> wrote:
>>  suppose there is a 'foo' function which exists in several places.
>>  E.g. it may exist as a core Octave function and in a number of
>>  loaded packages.
>> 
>>  Is there a way to explicitly tell Octave which function is meant
>>  without unloading the packages ?
> 
> No.
> 
>>  For example, 'sumsq' exists as both part of nan-2.5.5 package and 
> as
>>  Octave built-in function.
> 
> No, this is intentional. The author of the NaN package thinks that
> sumsq([1 NaN 3]) produces "buggy" output in Octave and deliberately
> overwrites that behaviour. We have not come to an agreement about
> that, so the NaN package overwrites Octave functions and you can only
> avoid this by not using the package.
> 
> - Jordi G. H.
>

Well, in, for example, Perl there are packages as namespaces.

I.e. a 'bar' function from 'Foo' package can explicitly be called as

Foo::bar(...)

, and Foo package can export 'bar' to global namespace - in such a case 'bar' 
can simply be called as

bar
,

but this is not considered to be good practice to export to global namespace 
automatically.

So, how about introducing namespaces in Octave (instead of automatic 
broadcasting) ?

Thanks,
  Sergei.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]