View mode: basic / threaded / horizontal-split · Log in · Help
April 28, 2012
Re: Designing a consistent language is *very* hard
On Saturday, 28 April 2012 at 15:43:52 UTC, H. S. Teoh wrote:
> After reading this article, I'm seriously considering adopting 
> D as my language of choice for CGI. ;-)

D rox.
April 28, 2012
Re: Designing a consistent language is *very* hard
On Saturday, 28 April 2012 at 15:43:52 UTC, H. S. Teoh wrote:
> IMNSHO, *any* language that has === is
> fundamentally, irreparably dainbramaged, and needs to be 
> scrapped and
> redesigned from scratch.

Well, in D we have "is", so… (/me ducks)

David
April 28, 2012
Re: Designing a consistent language is *very* hard
On Sat, Apr 28, 2012 at 06:19:44PM +0200, David Nadlinger wrote:
> On Saturday, 28 April 2012 at 15:43:52 UTC, H. S. Teoh wrote:
> >IMNSHO, *any* language that has === is fundamentally, irreparably
> >dainbramaged, and needs to be scrapped and redesigned from scratch.
> 
> Well, in D we have "is", so… (/me ducks)
[...]

To be frank, I find the various syntaxes of 'is' very inconsistent and
jarring. It has elicited several WATs from me while learning D. There's
no question that the various *uses* to which the syntax has been
assigned is extremely useful, but the syntax itself could do with a
redesign.

I mean, first you have:

	is(A==B)	is the type A is equal to the type B

If it were up to me, I'd have used instead the syntax:

	A==B

since, after all, A and B are already known to be types.

Then you have:

	is(A : B)	is the type A implicitly convertible to B

OK, not the best thing, but at least type comparisons are consistently
done in is() syntax, so it's partly palatable. Using : for implicit
convertibility is questionable, but at least there's an analogy with
base class syntax. So OK.

But then:

	is(A B)		if type A is a valid type, alias it to B

WAT? There's absolutely no correspondence between this syntax and the
previous two cases. NOBODY reading this code would be able to guess its
meaning unless they have already learnt the syntax. (Nobody would guess
what that piece of PHP code does unless they have already memorized its
meaning.)

Worse, you have:

	is(A B : C[D])	if type A is the same as (or is a subclass of)
			some kind of associative array

OK, there's no doubt the *meaning* of this construct is extremely
useful, but seriously, the syntax is just as bad as PHP's predisposition
to unexpected exceptions to arbitrary rules.

Then you have the overload of 'is' to mean a pointer comparison
operator:

	A is B		if A and B point to the same thing

This I can accept, since with D's implicit pointer deferencing, you'd
expect == to compare values, so when you want to compare identity (i.e.
are these two references pointing to one and the same thing?) you do
need a different syntax for it.

But the overload of 'is' as an operator with 'is()' as an expression
(and its various ugly arbitrarily assigned syntaxes)? WAT.

Seriously, one of the first things I'd like to see in D3 is a complete
overhaul of is(). I say again, the various *semantics* of it are
extremely useful, and are part of what makes D rock so much. But the
*syntax* badly needs a total redesign. We need much saner syntax
assigned to each of the current uses of is(), that doesn't look like it
was grafted in from a PHP development branch.


T

-- 
Life is unfair. Ask too much from it, and it may decide you don't
deserve what you have now either.
April 28, 2012
Re: Designing a consistent language is *very* hard
On 4/28/2012 11:10 AM, H. S. Teoh wrote:
> But the overload of 'is' as an operator with 'is()' as an expression
> (and its various ugly arbitrarily assigned syntaxes)? WAT.

It's not that unusual for an operator to have a binary form that is totally 
different from its unary form. Like *

> Seriously, one of the first things I'd like to see in D3 is a complete
> overhaul of is(). I say again, the various *semantics* of it are
> extremely useful, and are part of what makes D rock so much. But the
> *syntax* badly needs a total redesign. We need much saner syntax
> assigned to each of the current uses of is(), that doesn't look like it
> was grafted in from a PHP development branch.

I agree that the IsExpression syntax is a bit of a disaster. Eventually we can 
redesign it (D3), but there's no way we have time to do that now.
April 28, 2012
Re: Designing a consistent language is *very* hard
"Paulo Pinto" <pjmlp@progtools.org> wrote in message 
news:oughgmvgoiiietkedaxa@forum.dlang.org...
> On Saturday, 28 April 2012 at 09:41:06 UTC, Nick Sabalausky wrote:
>> "Paulo Pinto" <pjmlp@progtools.org> wrote in message
>> news:jngarb$14un$1@digitalmars.com...
>>>
>>> Well, I cry everytime I am using it on my web site, but the effort to
>>> port the scripts is not worth it.
>>
>> Abandoning PHP is *always* "worth it".
>
> Rewriting seldom brings anything new. It almost like starting
> from zero, without the benefit from all the bug fixes the
> software has had along the years.
>

Well, rewriting != porting.

> The hours wasted porting to a new language, could be used adding
> features to existing code base, or refactoring.
>

I had a big project recently that was about half Flash. About halfway 
through, I ported all the Flash from AS2 to Haxe (and switched the 
resource-embedding from the Flash IDE to swfmill): It wasn't particularly 
difficult, and it more than paid off in the end.

> I know how I am speaking about, many of the big bucks we get on
> consultancy jobs, are from companies that decide to keep rewriting
> their software on the flavour of the month framework, just because
> "everyone else is doing it".
>

Well, yea, *that* would certainly be a problem. And I agree there are times 
when porting languages is not worth it. But I do have a very hard time 
imagining that porting away from PHP could ever be unworthwhile.

I'm not trying to talk you into porting your stuff, though. Just sayin'.

> So I rather keep my "almost clean" PHP scripts running, as getting
> to the trouble of switching ISP just to be able to rewrite the site
> in a more sane language.
>

Eh, personally, I find the PHP-only webhosts to always be nightmares to deal 
with. Even the shared hosts that are nice enough allow native-compiled CGI 
still tend to be a pain. I switched to Linode (VPS) about a couple months 
ago, and I'm absolutely in love with it already.

Heck, last night, I even got the thought in my head of converting one of my 
client's sites (that's hosted on a real shit PHP-only webhost) to my linode 
server, and just making their server proxy to mine (via PHP if I have to). I 
don't think I actually will, but it's a tempting thought (after all, I have 
gotten him to agree, at least in principle, to switching to shared host that 
allows native-compiled CGI). But I guess I'm rambling now. And YMMV, FWIW, 
Etc, OMGWTFBBQ...
April 28, 2012
Re: Designing a consistent language is *very* hard
"deadalnix" <deadalnix@gmail.com> wrote in message 
news:jngirs$1jlf$1@digitalmars.com...
> Le 28/04/2012 11:27, Nick Sabalausky a écrit :
>> "Guillaume Chatelet"<chatelet.guillaume@gmail.com>  wrote in message
>> news:vwpzirpppabcgylmvpsx@forum.dlang.org...
>>> Sorry for the noise but I think a few language designer out there might
>>> like this one :
>>> http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
>>>
>>
>> "PHP: a fractal of bad design" is the absolute most perfect summary of 
>> PHP
>> anyone could ever possibly make. It is the world's worst still-living
>> non-joke language, period.
>
> Please note that Rasmus Ledorf stated many time that He « don't know how 
> to design a programming language », « never intended to create a 
> programing language », « don't like programing » and probably the funniest 
> one « don't how to stop it » it being the success of PHP.
>

Ugh. That just makes the whole situation even more pathetic.
April 28, 2012
Re: Designing a consistent language is *very* hard
On Saturday, 28 April 2012 at 18:43:32 UTC, Walter Bright wrote:
> On 4/28/2012 11:10 AM, H. S. Teoh wrote:
>> But the overload of 'is' as an operator with 'is()' as an 
>> expression
>> (and its various ugly arbitrarily assigned syntaxes)? WAT.
>
> It's not that unusual for an operator to have a binary form 
> that is totally different from its unary form. Like *
>
>> Seriously, one of the first things I'd like to see in D3 is a 
>> complete
>> overhaul of is(). I say again, the various *semantics* of it 
>> are
>> extremely useful, and are part of what makes D rock so much. 
>> But the
>> *syntax* badly needs a total redesign. We need much saner 
>> syntax
>> assigned to each of the current uses of is(), that doesn't 
>> look like it
>> was grafted in from a PHP development branch.
>
> I agree that the IsExpression syntax is a bit of a disaster. 
> Eventually we can redesign it (D3), but there's no way we have 
> time to do that now.

So .. D3 is coming? *runs*
April 28, 2012
Re: Designing a consistent language is *very* hard
"H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message 
news:mailman.45.1335627900.24740.digitalmars-d@puremagic.com...
> On Sat, Apr 28, 2012 at 10:18:33AM +0200, Guillaume Chatelet wrote:
>> Sorry for the noise but I think a few language designer out there
>> might like this one :
>> http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
>>
>> I think Walter and Andrei will smile ( or cry ) reading it.
>> It's no trolling here, I do think this post is very valuable and
>> relevant from a language design perspective.
>
> I've written some simple apps in PHP... never learned enough of it to
> run into all the problems listed on that page. But I *did* run into
> stupidities involving ===. IMNSHO, *any* language that has === is
> fundamentally, irreparably dainbramaged, and needs to be scrapped and
> redesigned from scratch. This includes that hellspawn of evil incarnate
> known as Javascript.
>

So true.

> After reading this article, I'm seriously considering adopting D as my
> language of choice for CGI. ;-)
>

I've already been sold on it for quite some time. Unfortunately, my biggest, 
most important web project is built in Haxe that's compiled down to *both* 
PHP and Flash, so I can't realistically switch until I have a way to keep 
the common server/client code *common*, without dupicating it in two 
different langauges for client and server (hence, my HaxeD project). Being 
able to have a common codebase for client/server is seriously such a killer 
feature, or at least it has been for my particular project.
April 28, 2012
Re: Designing a consistent language is *very* hard
Le 28/04/2012 21:27, q66 a écrit :
> On Saturday, 28 April 2012 at 18:43:32 UTC, Walter Bright wrote:
>> On 4/28/2012 11:10 AM, H. S. Teoh wrote:
>>> But the overload of 'is' as an operator with 'is()' as an expression
>>> (and its various ugly arbitrarily assigned syntaxes)? WAT.
>>
>> It's not that unusual for an operator to have a binary form that is
>> totally different from its unary form. Like *
>>
>>> Seriously, one of the first things I'd like to see in D3 is a complete
>>> overhaul of is(). I say again, the various *semantics* of it are
>>> extremely useful, and are part of what makes D rock so much. But the
>>> *syntax* badly needs a total redesign. We need much saner syntax
>>> assigned to each of the current uses of is(), that doesn't look like it
>>> was grafted in from a PHP development branch.
>>
>> I agree that the IsExpression syntax is a bit of a disaster.
>> Eventually we can redesign it (D3), but there's no way we have time to
>> do that now.
>
> So .. D3 is coming? *runs*

I think it is too soon for D3, but at some point, breaking changes will 
have to be introduced.
April 28, 2012
Re: Designing a consistent language is *very* hard
On 4/28/2012 12:27 PM, q66 wrote:
> So .. D3 is coming? *runs*

Not anytime soon.
1 2 3
Top | Discussion index | About this forum | D home