[Haskell-i18n] unicode notation \uhhhh implementation

Ketil Z. Malde ketil@ii.uib.no
16 Aug 2002 14:04:04 +0200


Sven Moritz Hallberg <pesco@gmx.de> writes:

> Would allowing the full Unicode names give an advantage? Something like
> GREEK_SMALL_LETTER_THETA is almost half a line and might do more harm to
> the code readability than uhhhh.

Well, it depends, I suppose.  I'm more likely to be able to remember
that '#GREEK_SMALL_LETTER_THETA represents an angle than \uXXXX.
Although, I of course would prefer '&theta' or '{\theta}' or something
like that.

It is possible that a shortish list of TeX symbols or HTML entities,
or both, would suffice.

Readability is one thing, however, I'm not quite sure how layout would
be affected with this.  I'm often surprised to hear about the problems
people experience with layout, it just seems to work for me.  (Using
Emacs and auto-indent; there's rarely any problem pressing TAB until
the right indentation is reached.)  

However, now it appears that indentation might change, according to
encoding used.  How do we solve that?  

The simple solution is to count one Unicode character as one
indentation character, but that would mean having alignments visually
distorted if we are using other notations.  Emacs could probably
handle this and display things correctly, but do we want that extra
complexity?  

        case t of Rad _ -> foo
                  Deg _ -> bar

--                ^visual alignment

        case &theta of Rad _ -> foo
                  Deg _ -> bar              

--                ^aligned, but only by counting

(Ditto for \uXXXXXXXX, of course)

After all, isn't layout intended to make things *easier* to read?

I think I'm in favor of requiring a line break when starting a layout
block, but I suppose that will break a lot of existing code.

(e.g

        case &theta of 
                Rad _ -> foo
                Deg _ -> bar

and only require more indentation (i.e. leading whitespace) than the
preceeding 'case' opening the block.
)

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants