Re: for the sake of conversation - syntax

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

 



On 30 Sep 2008, at 17:40, Nathan Rixham wrote:
Stut wrote:
Consider this...
file1.php:
package arse
{
   class bandit
   {
       ...
   }
}
package nipple
{
   class clamp
   {
       ...
   }
}
file2.php:
import file1 as chest;
Which package have I aliased as chest in file2.php?
This could be solved using "import file1 into chest" which presumably would then give me chest::arse::bandit and chest::nipple::clamp but that's pretty nasty.

see I'd lock it to one class per file; multiple files/classes per package :) I think one should always keep their arse and nipple seperate.

consider:

file: /classes/net/stut/body/arse.php
package net.stut.body.arse
{
   class bandit
   {
       ...
   }
}

file: /classes/net/stut/body/nipple.php
package net.stut.body.nipple
{
   class clamp
   {
       ...
   }
}

file: /classes/net/stut/body/chest.php
package /classes/net/stut/body/chest
{
   import net.stut.body.nipple;
   class chest
   {
       ...
   }
}

or

file: /classes/net/stut/body/chest.php
import net.stut.body.nipple;
$u = new arse::bandit;

whhhhhhiiiiiiiiiiiiiicccchhhhhhh leads me back to my earlier q of how would this new style work when doing things the procedural way.. even the above three lines; any potential problems there?

Sorry, I must have missed this question. Since namespaces are effectively another level or organisation above classes there's really no issue at all with only having in them, at least conceptually. In fact I'd guess you'd be implementing limitations where no limitation is necessary if you were to limit namespace contents to classes. I would hope the current PHP implementation does not have this limitation but I've not had much time to play with it yet.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux