[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hugs-bugs
Subject:    Re: smelly code in input.c
From:       Anthony Clayden <anthony.d.clayden () gmail ! com>
Date:       2021-06-15 7:33:20
Message-ID: CABU_mxjtZL0c4GAr9Z8et5KSV-ExY=0KedAquknYf5vS0amA6w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks Iavor, nothing ventured nothing gained I went ahead and made that
change.

I can't find any difference in behaviour for well-formed code. I can't find
any difference in whether code is accepted/rejected.

But there's a difference in error messages for ill-formed code,
specifically ill-formed qualified vars/constrs:

* standard-issue Hugs reports
    Undefined qualified variable "Mod1.Sub2.Subsub3.
    "
    -- that is, shows trailing spaces and newline after the trailing dot.

* modified Hugs reports
    Syntax error in expression (unexpected `;', possibly due to bad layout)
    -- or unexpected `}'  -- these are pseudo- semicolon/closing brace, not
actually in the file
    -- that is, it's 'munched' the trailing spaces and newline, then bumped
into start of next statement
    -- so layout-control inserts the pseudo-'s

Then perhaps that smelly code is deliberate, to give a more helpful
rejection message? hmm hmm

I still can't see why/how the parsing works for well-formed qualified
vars/constrs. But best to let sleeping dogs lie.

AntC

On Tue, 15 Jun 2021 at 03:13, Iavor Diatchki <iavor.diatchki@gmail.com>
wrote:

> I don't not know that code either, but looking at the comments and the
> surrounding code, my guess is that the 2nd `c0` should be `c1`,
> and it is checking for something like `.` followed by either a lower case
> or upper case or symbol operator.
>
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>Thanks Iavor, nothing ventured nothing gained I went ahead and \
made that change.</div><div><br></div><div>I can&#39;t find any difference in \
behaviour for well-formed code. I can&#39;t find any difference in whether code is \
accepted/rejected.</div><div><br></div><div>But there&#39;s a difference in error \
messages for ill-formed code, specifically ill-formed qualified \
vars/constrs:</div><div><br></div><div>* standard-issue Hugs reports  \
</div><div><span style="font-family:Arial,Helvetica,sans-serif">      Undefined \
qualified variable &quot;Mod1.Sub2.Subsub3.</span></div>      &quot;<br><div>      -- \
that is, shows trailing spaces and newline after the trailing \
dot.</div><div><br></div><div>* modified Hugs reports</div><div>       Syntax error \
in expression <span style="font-family:Arial,Helvetica,sans-serif">(unexpected \
`;&#39;, possibly due to bad layout)</span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif">      -- or unexpected `}&#39;   -- \
these are pseudo- semicolon/closing brace, not actually in the \
file</span></div><div><span style="font-family:Arial,Helvetica,sans-serif">      -- \
that is, it&#39;s &#39;munched&#39; the trailing spaces and newline, then bumped into \
start of next statement</span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif">      -- so layout-control inserts the \
pseudo-&#39;s</span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif">Then perhaps that smelly code is \
deliberate, to give a more helpful rejection message? hmm hmm</span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif">I still can&#39;t see why/how the \
parsing works for well-formed qualified vars/constrs. But best to let sleeping dogs \
lie.</span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div><span \
style="font-family:Arial,Helvetica,sans-serif">AntC</span></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 15 Jun 2021 at 03:13, \
Iavor Diatchki &lt;<a \
href="mailto:iavor.diatchki@gmail.com">iavor.diatchki@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I \
don&#39;t not know that code either, but looking at the comments and the surrounding \
code, my guess is that the 2nd `c0` should be `c1`,</div><div>and it is checking for \
something like `.` followed by either a lower case or upper case or symbol  \
operator.<br></div><div><br></div></div><div class="gmail_quote"><br></div> \
</blockquote></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
Hugs-Bugs mailing list
Hugs-Bugs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-bugs

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic