assert that with (have you hugged your compiler today)

Programming, for all ages and all languages.
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

assert that with (have you hugged your compiler today)

Post by mikegonta »

the-ideom has an assert statement which looks like this:

Code: Select all

  assert that the rider's token is not "break" or that the rider's token is "repeat" or 
   that the rider's token is "return" with "This is only a test since the rider's token is actually '" and then 
   the rider's token and then "'!";
The 'not "break"' is of course for testing since "break" will appear as a token in some cases. The general form of the assert statement is:

"assert that" followed by one or more deciders (in this case - 3 joined with logical 'or' and an optional formatted display message.

The error message produced has the standard "bits" - namely:
  • the assertion
    the file
    the line #
    the routine header
    the optional formatted display message

Code: Select all

The assertion that 'the rider's token is not "break" or that the rider's token is not "repeat" or that the rider 's token is "return"' FAILED 
in the file 'statement.ideom' at line 241 
in the routine 'compile the next statement with a rider {single}' 
This is only a test since the rider's token is actually 'break'!
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Octocontrabass
Member
Member
Posts: 5521
Joined: Mon Mar 25, 2013 7:01 pm

Re: assert that with (have you hugged your compiler today)

Post by Octocontrabass »

For all the threads you keep making (and deleting) about the-idiom, I don't think you've ever had a download link for a working copy of your compiler. Why is that?
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: assert that with (have you hugged your compiler today)

Post by iansjack »

Clearly that is not code from a working compiler, as the error message details different conditions than the "assert". The assertion in the error message would always succeed, so why the message?
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: assert that with (have you hugged your compiler today)

Post by mikegonta »

iansjack wrote:Clearly
As clear as mud.
iansjack wrote:that is not code from a working compiler, as the error message details different conditions than the "assert".
This optional runtime message in the compile time assertion is for the purpose of this test and could be something like:

Code: Select all

 Oops, you really f*cked up this one, where the heck did you find a token like 'brown cow'!
or whatever the runtime token was.
iansjack wrote:The assertion in the error message would always succeed, so why the message?
An assertion "would always succeed" only when there are no programmer errors.
This assertion is a test, as I previously mentioned. Here I'm asserting that the token is not "break" when in fact it is, so obviously the assertion fails.
The actual code in the-ideom asserts that the token is "break".
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: assert that with (have you hugged your compiler today)

Post by iansjack »

The assertion that 'the rider's token is not "break" or that the rider's token is not "repeat" or that the rider 's token is "return"' FAILED
in the file 'statement.ideom' at line 241
Possible cases:

1. The token is "break" - then it's not "repeat", so the assertion succeeds.

2. The token is "repeat" - then it's not "break", so the assertion succeeds.

3. The token is anything else - then it's not "break" (and it's not "repeat"), so the assertion succeeds.

In any case, the assertion succeeds. So why the message saying it failed? Of course the answer is ("clearly") that this message is just something you typed (and made a mistake in doing so), not a message produced by a working compiler. :-)
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: assert that with (have you hugged your compiler today)

Post by mikegonta »

iansjack wrote: Of course the answer is ("clearly") that this message is just something you typed (and made a mistake in doing so)
You're absolutely right, and thank you for reviewing my code. Actually the original assertion was:

Code: Select all

  assert that the rider's token is "repeat" or that the rider's token is "break" or that the rider's token is "return" with "This is only a test since the rider's token is actually '" and then the rider's token and then "'!";
To test the code which generates the assertions I changed the assertion to

Code: Select all

  assert that the rider's token is "repeat" or that the rider's token is not "break" or that the rider's token is "return" with "This is only a test since the rider's token is actually '" and then the rider's token and then "'!";
then I copied the command line window error message for this post. I then edited the assertion and the error message to put the "break" as the first decider for emphasis (so that it wouldn't get lost inside the or's and as you have so correctly pointed out I made a typo and left the not before the "repeat". the original error message was in fact:

Code: Select all

The assertion that 'the rider's token is "repeat" or that the rider's token is not "break" or that the rider 's token is "return"' FAILED 
in the file 'statement.ideom' at line 241 
in the routine 'compile the next statement with a rider {single}' 
This is only a test since the rider's token is actually 'break'!
Thanks for pointing out the typo that I made in the original post.
PS. There is a compiler writer's technical typo in there.
Last edited by mikegonta on Tue Mar 17, 2020 5:43 am, edited 1 time in total.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: assert that with (have you hugged your compiler today)

Post by iansjack »

All I was pointing out was that the message wan't produced by a compiler. Prompted by an earlier question in this thread.
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: assert that with (have you hugged your compiler today)

Post by mikegonta »

iansjack wrote:wan't
Sh*t happens.
iansjack wrote:Prompted by an earlier question in this thread.
That question was off topic.
And besides that, Octocontrabass spelled the-ideom wrong.
Sometimes I spell it wrong too.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Octocontrabass
Member
Member
Posts: 5521
Joined: Mon Mar 25, 2013 7:01 pm

Re: assert that with (have you hugged your compiler today)

Post by Octocontrabass »

mikegonta wrote:And besides that, Octocontrabass spelled the-ideom wrong.
Right, "the-ideom". Where can I download it?
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: assert that with (have you hugged your compiler today)

Post by iansjack »

mikegonta wrote:
iansjack wrote:wan't
Sh*t happens.
Rest assured that, as you demonstrate, my post was typed by a human, not by a compiler
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: assert that with (have you hugged your compiler today)

Post by mikegonta »

Octocontrabass wrote:Right, "the-ideom".
Good point!
Octocontrabass wrote:Where can I download it?
I've updated my web sites (but not with a link).
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: assert that with (have you hugged your compiler today)

Post by Schol-R-LEA »

mikegonta wrote:
Octocontrabass wrote:Right, "the-ideom".
Good point!
Octocontrabass wrote:Where can I download it?
I've updated my web sites (but not with a link).
So... it is closed-source, and there's no download link. Is the cat alive, dead, or in superposition between the two states?
Pterry's third determinate state is an acceptable answer, too, I suppose.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Octocontrabass
Member
Member
Posts: 5521
Joined: Mon Mar 25, 2013 7:01 pm

Re: assert that with (have you hugged your compiler today)

Post by Octocontrabass »

mikegonta wrote:I've updated my web sites (but not with a link).
Why should I be interested in the-ideom if you won't let me download it?
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: assert that with (have you hugged your compiler today)

Post by mikegonta »

Octocontrabass wrote:Why should I be interested in the-ideom …
Say it ain't so.
And yet you are obviously not interested in a compile time assert statement with a runtime message attached.
Or maybe you might prefer a column number (it's on my todo list) along with the line number or as an indicator (^) under the display line.
Octocontrabass wrote:… if you won't let me download it?
the-idiom is still a moving target. Soon I will be accepting email requests for vetting (source code only - no binaries) and later on for beta testers.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: assert that with (have you hugged your compiler today)

Post by PeterX »

There's a guy on the warpath. I wonder why.
Post Reply