--- Alan Knowles <[EMAIL PROTECTED]> wrote:
>  From my reading of delegation, it's really overloading, worded slightly 
> differently.. - but not that related to interfaces...
> 
> In the example below, which is a php'ized version of a C# demo, the 
> advantages of using interfaces (as far as I know) are primarly useful 
> for COM or CORBA, where it would be possible to generate all the 
> components for a CORBA/COM/.NET, or even java binding by reading the 
> interfaces.
> 
> A .NET binding would effectively define all the available interfaces and 
> classes, with strong typing!, and then when called (from C# or .NET) 
> invoke a C call to call_user_function, to run php exectuter.... 
> (probably the best way to implement a .NET server in php, - compiling a 
> loosely typed language into .NET bytecodes, from reading about 
> python,perl etcs. experience is not the way to go..)
> 
> Other than being nice for documentation, in pure PHP, I cant really see 
> them being much use...
> 
> Interesting subject anyway..
> 
> Regards
> Alan
> 
> called from C#
> 
> PHP_Celcius c = new PHP_Celcius(12.9);
> system.out(c.toFarenheight().toString());
> 
> 
> 
> 
> Interface temperature {
>      function __construct(float $value);
>      float function toCelcius();
>      float function toFarenheight();
> }

 There really are two different things here..

1) "Type Hints" meaning you can define the types of variables
 This has been discussed before it hasn't been turned down or implemented.

2) Interfaces as they exist in java don't really give you much in a stripting
language but if you insist on having something like that you can curently do it
with the zend1.

class temperature {
      function __construct($value) {}
      function toCelcius() {}
      function toFarenheight() {}
 }

just use that class and extend away....



but this does bring up an intresting thing... To really implement interfaces
when/if delegation is implemented would be easy.

1) create a interface keyword : which is easy
2) in that state allow only function (name)(params)(semi) : i believe this is
easy
3) internally compile them as normal functions with no implemntation or see if
an e_notice can be thrown. : pretty sure this is easy as well

Im not saying that we should but it doesn't seem to be very hard at all. I
think it exists as neat vs usefull issues.

- Brad

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to