> > IMHO the syntax you suggest is a bit terse, what about this instead:
> >
> > echo url"http://$host:$port/$path";;
>
> Looks perlish to me, I'd rather see a casting thing like this then:
>
> echo (url) "http://$host:$port/$path";;

I was originally thinking about casting too, but although I'm sure it
could be done, I don't think it's good to have casting(-like) syntax
have the effect I proposed. You see, what I proposed is having a
different behaviour already on inserting the variables ($host, $port
and $path in the above example would be converted to url string type)
into the string. With casting, the behaviour would be to first make a
normal string, and then cast it as a whole, losing the information
about the inserted variables.

> but then you just could make it a function (or a language construct):
>
> echo url("http://$host:$port/$path";);

Same argument against a function; could be a language construct, but
I think it would be less intuitive - it would look like you first
make a normal string and then convert it, which is not the case in my
proposal.

> but this can break BC as those functions may be in use in scripts.

Yeah, unless we give them really long and ugly names. Not sure if
that's a good idea, though. ;-)

> > But I would like to extend the idea beyond reformatting inserted
> > strings.  For example, for easy soap/xmlrpc serialization, being able to
> > tag a value as a date or some other soap/xmlrpc-specific type is very
> > useful.
>
> It might, but remember that PHP is not a strong typed language; somehow it
> feels like this is not just PHP then.

PHP would not become a strong typed language. It would be... perhaps
optionally sub-typed? :-) I wouldn't worry about this.

Vaclav Dvorak  ([EMAIL PROTECTED])
http://nebuchadnezzar.zion.cz/

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

Reply via email to