import ::Exception AS WTF;
import isn't the means to shuffle standard class names around. Import is
the means to make names shorter. You already have one Exception in
global space, you'd have to use other name for other class.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]
Hi internals,
I think you are conentrating on the Exception (and even internal class)
examples a bit too much. Take the following example:
a.php:
b.php:
c.php:
d.php:
Running this example produces a "Fatal error: Import name 'Foo'
conflicts with d
The exception example is well an exception. Here you must inherit
exception.
That is simply how PHP works, it is an intended limitation. That
said in
this case you should not use Exception for your own stuff. Name it
after
your library or product, like MyProductException.
Hey, i have an
The above code works just fine.
Yes there is a concept. import is best used within a namespace. So,
namespace your code and there is no need to import global classes.
Yep, it works if your whole application uses one namespace, but what
if you have a core package that defines some except
Hello Benjamin,
Wednesday, October 3, 2007, 5:33:21 PM, you wrote:
>>
>> if your exception is so general that it is called exception you can
>> obviously simply use exception.
> Maybe _my_ exception is a generic exception in _my_ framework and
> implements some helper functions i need?
The
if your exception is so general that it is called exception you can
obviously simply use exception.
Maybe _my_ exception is a generic exception in _my_ framework and
implements some helper functions i need? But the discussion is not
about exceptions, it's about classnames that PHP declare
Hello Benjamin,
if your exception is so general that it is called exception you can
obviously simply use exception. If your exception is actually doing
something than name that something. Meaning the name of the exception class
is carrying information already. Thus every exception should be spec
Hello Stanislav,
perfectly right :-)
Tuesday, October 2, 2007, 10:21:20 PM, you wrote:
>> But how to know in advance, e.g. think about other libraries, which
>> public classes possibly exist? Isn't this problematic then?
> That should be simple - if you write library using namespaces, no publ
Benjamin Schulz wrote:
> On 02.10.2007, at 22:04, Stanislav Malyshev wrote:
>
>
>>> >> import ::Exception as Notused;
>>> import Foo::Exception;
>>> ?>
>>>
>>
>> I wouldn't actually recommend using such code. If you have
>> Foo::Exception just use Foo::Exception - it's short enough :)
>>
>
> And
On 02.10.2007, at 22:04, Stanislav Malyshev wrote:
I wouldn't actually recommend using such code. If you have
Foo::Exception just use Foo::Exception - it's short enough :)
And what if not? "throw App::package::subpackage::Exception" in a
file that has the namespace "App::package::su
But how to know in advance, e.g. think about other libraries, which
public classes possibly exist? Isn't this problematic then?
That should be simple - if you write library using namespaces, no public
classes would exist except for the internal ones :)
By "public" I of course mean "belonging
But how to know in advance, e.g. think about other libraries, which
public classes possibly exist? Isn't this problematic then?
That should be simple - if you write library using namespaces, no public
classes would exist except for the internal ones :)
--
Stanislav Malyshev, Zend Software Arc
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
Greg Beaver wrote:
> Benjamin Schulz wrote:
>> Of course i want to refer to my own exception in my application or
>> framework as "Exception", and of course i want to use it without
>> prefixes (import myStuff::Exception AS MyStuffException), i wo
I wouldn't actually recommend using such code. If you have
Foo::Exception just use Foo::Exception - it's short enough :)
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN: [EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development
Benjamin Schulz wrote:
> Hi all,
>
> import Foo::Bar AS DomDocument;
> import Foo::Exception;
> import MyStuff::Dom::XsltProcessor;
>
> Result in a "Fatal error: Import name '...' conflicts with defined class"
> Of course i want to refer to my own exception in my application or
> framework as "Ex
15 matches
Mail list logo