Perl's lack of 'in' keyword

Nigel Rantor wiggly at wiggly.org
Wed Oct 8 14:51:51 BST 2008


Andy Armstrong wrote:
> On 8 Oct 2008, at 12:18, Nigel Rantor wrote:
>> And, having already read Iain's reply, I agree. That's not the winning 
>> attitude that Perl advocates should aim to present.
> 
> 
> I wasn't whining. In fact I don't think I do whining. It was a serious 
> question - should we allow the design of the language to be influenced 
> by a focus group consisting of people who dislike it?

Okay, good, I didn't think you were whining, just being a little 
aggressive. But that's e-mail for you, no tone or register.

On topic, I would say that someone "complaining" that something looks 
too much like line noise is not necessarily someone who "dislikes" the 
language.

I like Perl, but I complain about it all the time.

For example, threads? Please? POE sucks arse in lots of areas where a 
threading implementation that worked somewhat like POSIX would be 
infinitely easier to use and debug. I complain less about this publicly 
because I do not have enough time to do it myself, and getting the 
obligatory "quicker if you help" answer to "when" isn't always helpful.

There's a difference between complaining so you can call something crap 
and complaining to get something made better. I think complaining that 
~~ is easily confused with -- is fairly valid. I also think that 
complaining that ~~ does not immediately tell you what it does is also 
valid.

> I take your point that perhaps some Perl people would also like to move 
> away from the line noise look. My view on that is that it's probably a 
> bit late for Perl 5 to change the habit of a lifetime so they should be 
> early adopters of Perl 6 where they can make the language look exactly 
> how they want it to :)

I'm not necessarily saying that we need to replace anything that is 
already there in the language, but why must we *add* more things that 
that look like noise?

Let's take "~~" for example. It's arguably harder to type than "in". And 
by that I mean for *me* it is harder to type. I need to hit shift to do 
it, so it's slower than 'in'. It is not shorter than 'in' so doesn't win 
on speed nor brevity. It also doesn't scan like english, so whilst 
something like:

die "can't find it guv!" unless $thing in @set;

reads quite nicely,

die "can't find it guv!" unless $thing ~~ @set;

doesn't.

If anyone comes back and tell me that they think ~~ scans nicely in 
english, is easier to type and provides a better, clearer explanation of 
what it does in code than 'in' I will say no more on the subject because 
we would just be dealing with a huge gulf in our mental models of the world.

   n



More information about the london.pm mailing list