November 06, 2008
Steven Schveighoffer:
> Even experienced developers fall into some of these traps.  I know I
> occasionally fell into this trap:
> if(x);
>   x->doSomething();
> But no more with D, because it's not allowed.  Those kinds of things can be
> easily prevented, and are common mistakes by all programmers.

In Delight it's also quite difficult to fall in that trap:
if x:
    x->doSomething()
Many variants of that syntax are all disallowed:
if x
    x->doSomething()
if x:
x->doSomething()
if x
x->doSomething()
etc.

So instead of making the language more confusing, it actually has the opposite effect.

Bye,
bearophile
November 06, 2008
BCS wrote:
> Reply to Walter,
> 
>> Steven Schveighoffer wrote:
>>
>>> Even experienced developers fall into some of these traps.  I know I
>>> occasionally fell into this trap:
>>>
>>> if(x);
>>> x->doSomething();
>>> But no more with D, because it's not allowed.  Those kinds of things
>>> can be easily prevented, and are common mistakes by all programmers.
>>>
>> Here's another fun one:
>>
>> printf("%d\n", 8l);
>>
>> What does that print?
>>
> 
> 8

If I hadn't said it was a trap, I bet you'd have said "81".
November 06, 2008
On Thu, Nov 6, 2008 at 5:07 PM, Walter Bright <newshound1@digitalmars.com> wrote:
> BCS wrote:
>>
>> Reply to Walter,
>>
>>> Steven Schveighoffer wrote:
>>>
>>>> Even experienced developers fall into some of these traps.  I know I occasionally fell into this trap:
>>>>
>>>> if(x);
>>>> x->doSomething();
>>>> But no more with D, because it's not allowed.  Those kinds of things
>>>> can be easily prevented, and are common mistakes by all programmers.
>>>>
>>> Here's another fun one:
>>>
>>> printf("%d\n", 8l);
>>>
>>> What does that print?
>>>
>>
>> 8
>
> If I hadn't said it was a trap, I bet you'd have said "81".

I wouldn't've, because I use a font that actually distinguishes things 1, I, l, and | properly.  <_<
November 06, 2008
Jarrett Billingsley wrote:
> On Thu, Nov 6, 2008 at 5:07 PM, Walter Bright
> <newshound1@digitalmars.com> wrote:
>> BCS wrote:
>>> Reply to Walter,
>>>
>>>> Steven Schveighoffer wrote:
>>>>
>>>>> Even experienced developers fall into some of these traps.  I know I
>>>>> occasionally fell into this trap:
>>>>>
>>>>> if(x);
>>>>> x->doSomething();
>>>>> But no more with D, because it's not allowed.  Those kinds of things
>>>>> can be easily prevented, and are common mistakes by all programmers.
>>>>>
>>>> Here's another fun one:
>>>>
>>>> printf("%d\n", 8l);
>>>>
>>>> What does that print?
>>>>
>>> 8
>> If I hadn't said it was a trap, I bet you'd have said "81".
> 
> I wouldn't've, because I use a font that actually distinguishes things
> 1, I, l, and | properly.  <_<

0 and O is another fun one. In any case, 8l is legal C, but illegal D.
November 07, 2008
On Fri, Nov 7, 2008 at 7:37 AM, Walter Bright <newshound1@digitalmars.com> wrote:
> Jarrett Billingsley wrote:
>>
>> On Thu, Nov 6, 2008 at 5:07 PM, Walter Bright <newshound1@digitalmars.com> wrote:
>>>
>>> BCS wrote:
>>>>
>>>> Reply to Walter,
>>>>
>>>>> Steven Schveighoffer wrote:
>>>>>
>>>>>> Even experienced developers fall into some of these traps.  I know I occasionally fell into this trap:
>>>>>>
>>>>>> if(x);
>>>>>> x->doSomething();
>>>>>> But no more with D, because it's not allowed.  Those kinds of things
>>>>>> can be easily prevented, and are common mistakes by all programmers.
>>>>>>
>>>>> Here's another fun one:
>>>>>
>>>>> printf("%d\n", 8l);
>>>>>
>>>>> What does that print?
>>>>>
>>>> 8
>>>
>>> If I hadn't said it was a trap, I bet you'd have said "81".
>>
>> I wouldn't've, because I use a font that actually distinguishes things 1, I, l, and | properly.  <_<
>
> 0 and O is another fun one. In any case, 8l is legal C, but illegal D.

Threre are various good programmer fonts out there today that are
designed to make the 1 l | and 0 O distinctions clear.
I use the Proggy fonts.  http://www.proggyfonts.com/index.php?menu=download

These days I'd say if you're not using one of these fonts for programming you're being an extremely silly person.

--bb
November 07, 2008
On Thu, Nov 6, 2008 at 7:02 PM, Bill Baxter <wbaxter@gmail.com> wrote:
> Threre are various good programmer fonts out there today that are
> designed to make the 1 l | and 0 O distinctions clear.
> I use the Proggy fonts.  http://www.proggyfonts.com/index.php?menu=download
>
> These days I'd say if you're not using one of these fonts for programming you're being an extremely silly person.

ProggyCleanSZ, thankyouverymuch.  Code doesn't look like code unless it's in that font ;)
November 07, 2008
Jarrett Billingsley:
> ProggyCleanSZ, thankyouverymuch.  Code doesn't look like code unless it's in that font ;)

I use this (it's free) and I'm very happy of it, but note it requires a bigger size than Proggy, so if you want to program with a little font this isn't good:
http://www.levien.com/type/myfonts/inconsolata.html

Bye,
bearophile
November 07, 2008
Walter Bright wrote:
> Jarrett Billingsley wrote:
>> On Thu, Nov 6, 2008 at 5:07 PM, Walter Bright
>> <newshound1@digitalmars.com> wrote:
>>> BCS wrote:
>>>> Reply to Walter,
>>>>
>>>>> Steven Schveighoffer wrote:
>>>>>
>>>>>> Even experienced developers fall into some of these traps.  I know I
>>>>>> occasionally fell into this trap:
>>>>>>
>>>>>> if(x);
>>>>>> x->doSomething();
>>>>>> But no more with D, because it's not allowed.  Those kinds of things
>>>>>> can be easily prevented, and are common mistakes by all programmers.
>>>>>>
>>>>> Here's another fun one:
>>>>>
>>>>> printf("%d\n", 8l);
>>>>>
>>>>> What does that print?
>>>>>
>>>> 8
>>> If I hadn't said it was a trap, I bet you'd have said "81".
>>
>> I wouldn't've, because I use a font that actually distinguishes things
>> 1, I, l, and | properly.  <_<
> 
> 0 and O is another fun one. In any case, 8l is legal C, but illegal D.

In CompSci1 we had use some ridiculous Mac editor where 0 and O were 100% identical, I,l, | and 1 also. It was an incredible source of bugs.
We had to write a parser/emulator for some stupid imaginary asm language they'd invented, where O01 was output register 1. Plus, whitespace was significant, but it wasn't a monospaced font...
It was like the whitespace programming language.
November 07, 2008
Bill Baxter wrote:
> On Fri, Nov 7, 2008 at 7:37 AM, Walter Bright
> <newshound1@digitalmars.com> wrote:
>> Jarrett Billingsley wrote:
>>> On Thu, Nov 6, 2008 at 5:07 PM, Walter Bright
>>> <newshound1@digitalmars.com> wrote:
>>>> BCS wrote:
>>>>> Reply to Walter,
>>>>>
>>>>>> Steven Schveighoffer wrote:
>>>>>>
>>>>>>> Even experienced developers fall into some of these traps.  I know I
>>>>>>> occasionally fell into this trap:
>>>>>>>
>>>>>>> if(x);
>>>>>>> x->doSomething();
>>>>>>> But no more with D, because it's not allowed.  Those kinds of things
>>>>>>> can be easily prevented, and are common mistakes by all programmers.
>>>>>>>
>>>>>> Here's another fun one:
>>>>>>
>>>>>> printf("%d\n", 8l);
>>>>>>
>>>>>> What does that print?
>>>>>>
>>>>> 8
>>>> If I hadn't said it was a trap, I bet you'd have said "81".
>>> I wouldn't've, because I use a font that actually distinguishes things
>>> 1, I, l, and | properly.  <_<
>> 0 and O is another fun one. In any case, 8l is legal C, but illegal D.
> 
> Threre are various good programmer fonts out there today that are
> designed to make the 1 l | and 0 O distinctions clear.
> I use the Proggy fonts.  http://www.proggyfonts.com/index.php?menu=download
> 
> These days I'd say if you're not using one of these fonts for
> programming you're being an extremely silly person.
> 
> --bb

I use and recommend the DejaVu Sans Mono font. With this font there is no chance of confusing those troublesome characters, and it's very easy on the eyes. Also, the DejaVu fonts are available in the repositories of many (most?) Linux distributions.

   http://dejavu.sourceforge.net/

-Lars
November 07, 2008
Bill Baxter wrote:
> These days I'd say if you're not using one of these fonts for
> programming you're being an extremely silly person.

That's great, but one doesn't always have control over the fonts.