View mode: basic / threaded / horizontal-split · Log in · Help
February 22, 2008
Re: My Kingdom For ...
On Thu, 21 Feb 2008, Jarrett Billingsley wrote:

> "Matti Niemenmaa" <see_signature@for.real.address> wrote in message
> news:fpkebq$274u$1@digitalmars.com...
>
>> Imagine the increased clarity:
>>
>> return *a !- *b ? *a!**b : foo!(int)!&a;
>
> This is clear?
>
> News to me!

Coding in high level languages with customizable operators tends to leave 
a mark ;)
February 22, 2008
Re: My Kingdom For ...
On 21/02/2008, Jarrett Billingsley <kb3ctd2@yahoo.com> wrote:
> "Janice Caron" <caron800@googlemail.com> wrote in message
>  God, have you even _used_ D?

I've written bits of Phobos, does that count?

D /does/ fall over in the circumstance I described. The only error
message you see on the console is "Win32 Exception". No filename. No
line number. It happened to me only yesterday, using D2.010.
February 22, 2008
Re: My Kingdom For ...
Jarrett Billingsley wrote:
> "Janice Caron" <caron800@googlemail.com> wrote in message 
> news:mailman.47.1203635455.2351.digitalmars-d@puremagic.com...
> 
>> And while we're on the subject of random falling over, am I the only
>> one who gets infuriated by the occasional "Win32 Exception" halting a
>> program with no further explanation? They happen when the flow of
>> execution hits the bottom of a function without returning, when it's
>> supposed to return something. I'm surprised we can't catch those at
>> compile time, but even a nice D Exception throw at runtime (...again,
>> in a debug build only...) would be useful.
> 
> Except that it _does_ throw an exception to that effect in a debug build. 
> God, have you even _used_ D? 

Have you seen std.xml?

[I know you were being rhetorical -- but it's a good chance to mention 
this first public contribution (AFAIK) from Janice.]

--bb
February 22, 2008
Re: My Kingdom For ...
Janice Caron Wrote:

> On 21/02/2008, Jarrett Billingsley <kb3ctd2@yahoo.com> wrote:
> > "Janice Caron" <caron800@googlemail.com> wrote in message
> >  God, have you even _used_ D?
> 
> I've written bits of Phobos, does that count?
> 
> D /does/ fall over in the circumstance I described. The only error
> message you see on the console is "Win32 Exception". No filename. No
> line number. It happened to me only yesterday, using D2.010.

Janice Caron Wrote:

> On 21/02/2008, Ary Borenszweig <ary@esperanto.org.ar> wrote:
> >  But programmers are used to use "==" for comparisons with null...
> >  Another alternative would be for the compiler to rewrite "== null" as
> >  "is null", always.
> 
> Yep. That works for me too.
> 
> Of course, what I'd /really/ prefer is a runtime check (in debug
> builds only, of course) for all null dereferences. I see it as
> basically the same as array bounds checking - for speed, you don't
> want it in a final release, but during development, you sacrifice the
> speed and let the compiler help out. That would be useful, because not
> only would it catch ==null, but it would also catch .member and
> .func(), and you'd get a nice error message telling what line of what
> file threw the exception.
> 
> And while we're on the subject of random falling over, am I the only
> one who gets infuriated by the occasional "Win32 Exception" halting a
> program with no further explanation? They happen when the flow of
> execution hits the bottom of a function without returning, when it's
> supposed to return something. I'm surprised we can't catch those at
> compile time, but even a nice D Exception throw at runtime (...again,
> in a debug build only...) would be useful.

Yes it does do that.  Yes it's annoying.  Yes, there's a way to catch those exceptions using... try/catch or scope(error) or scope(exit) and figuring it out.

No, you're not the only one who finds the limited error messages annoying.  It's about the only time I get rage on the machine - when I get unidentified compiler errors.  I would much prefer a *real* debugger like IDA Pro if it had hooks to bind it to another program's GP faults and other such errors.

Lately I've been writing Walnut in assembler and leveraging some OS function to hook one of my functions as my error handler with the OS.  I use the function to dump all the registers - though it would be nice to see a few items of the stack too.

It makes debugging that kind of crap alot easier.  Assembler allows anything the machine can do - which means your code can screw up in more ways than a compiled language can.

It also means I can write a lexer in under 2.5kb of machine code that runs 8 times as fast as a D compiled switch-based lexer.  The next Walnut will blaze.  : )
February 22, 2008
Re: My Kingdom For ...
Moritz Warning wrote:
> On Thu, 21 Feb 2008 09:53:00 -0700, Darryl Bleau wrote:
> 
>> bearophile wrote:
>>> Another solution is to think "in" as an operator, and "!in" as two
>>> operators, where ! negates the result of the precedent "in", where "in"
>>> returns a pointer. I don't see this as silly :-)
>> I should have read this first. Yes, that's exactly what I would like.
> 
> Fwiw:
> "is" may be no boolean operator, but "!" is a boolean operator.
> Hence, "!is" can be boolean operator the same way as "=" is not a boolean 
> operator, but "!=" is.

Did you man "in"? "is" is a boolean operator.
February 22, 2008
Re: My Kingdom For ...
Robert Fraser wrote:
> Moritz Warning wrote:
>> On Thu, 21 Feb 2008 09:53:00 -0700, Darryl Bleau wrote:
>>
>>> bearophile wrote:
>>>> Another solution is to think "in" as an operator, and "!in" as two
>>>> operators, where ! negates the result of the precedent "in", where "in"
>>>> returns a pointer. I don't see this as silly :-)
>>> I should have read this first. Yes, that's exactly what I would like.
>>
>> Fwiw:
>> "is" may be no boolean operator, but "!" is a boolean operator.
>> Hence, "!is" can be boolean operator the same way as "=" is not a 
>> boolean operator, but "!=" is.
> 
> Did you man "in"? "is" is a boolean operator.

I think Bill Clinton had something to say about this subject...
:-)
--bb
February 22, 2008
Re: My Kingdom For ...
Jari-Matti Mäkelä wrote:
> 
> 
> On Thu, 21 Feb 2008, Jarrett Billingsley wrote:
> 
>> "Matti Niemenmaa" <see_signature@for.real.address> wrote in message
>> news:fpkebq$274u$1@digitalmars.com...
>>
>>> Imagine the increased clarity:
>>>
>>> return *a !- *b ? *a!**b : foo!(int)!&a;
>>
>> This is clear?
>>
>> News to me!
> 
> Coding in high level languages with customizable operators tends to 
> leave a mark ;)

You were being serious? I need to rewire my sarcasm detector.
February 22, 2008
Re: My Kingdom For ...
Janice Caron wrote:
> Of course, what I'd /really/ prefer is a runtime check (in debug
> builds only, of course) for all null dereferences. I see it as
> basically the same as array bounds checking - for speed, you don't
> want it in a final release, but during development, you sacrifice the
> speed and let the compiler help out. That would be useful, because not
> only would it catch ==null, but it would also catch .member and
> .func(), and you'd get a nice error message telling what line of what
> file threw the exception.

Emphatic "me too".
February 22, 2008
Re: My Kingdom For ...
On Fri, 22 Feb 2008 00:04:18 +0000, Janice Caron wrote:

> On 21/02/2008, Jarrett Billingsley <kb3ctd2@yahoo.com> wrote:
>> "Janice Caron" <caron800@googlemail.com> wrote in message
>>  God, have you even _used_ D?
> 
> I've written bits of Phobos, does that count?

Ah ... well that accounts for some things now ... ;-) (Just kidding)

> D /does/ fall over in the circumstance I described. The only error
> message you see on the console is "Win32 Exception". No filename. No
> line number. It happened to me only yesterday, using D2.010.

Compile with the "-w" switch. It checks for 'missing' return paths.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
22/02/2008 1:14:13 PM
February 22, 2008
Re: My Kingdom For ...
On Fri, 22 Feb 2008 09:06:17 +0900, Bill Baxter wrote:

> Jarrett Billingsley wrote:
>> "Janice Caron" <caron800@googlemail.com> wrote in message 
>> news:mailman.47.1203635455.2351.digitalmars-d@puremagic.com...
>> 
>>> And while we're on the subject of random falling over, am I the only
>>> one who gets infuriated by the occasional "Win32 Exception" halting a
>>> program with no further explanation? They happen when the flow of
>>> execution hits the bottom of a function without returning, when it's
>>> supposed to return something. I'm surprised we can't catch those at
>>> compile time, but even a nice D Exception throw at runtime (...again,
>>> in a debug build only...) would be useful.
>> 
>> Except that it _does_ throw an exception to that effect in a debug build. 
>> God, have you even _used_ D? 
> 
> Have you seen std.xml?
> 
> [I know you were being rhetorical -- but it's a good chance to mention 
> this first public contribution (AFAIK) from Janice.]

Which by the way is quite nice code and works well. (I was wondering how it
can be used to generate a DTD file from an XML document though.)

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
22/02/2008 1:15:26 PM
1 2 3 4 5 6 7 8
Top | Discussion index | About this forum | D home