help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check for redundancy


From: Yuri Khan
Subject: Re: Check for redundancy
Date: Sun, 28 Jun 2015 22:35:02 +0600

On Sun, Jun 28, 2015 at 9:50 PM, Emanuel Berg <embe8573@student.uu.se> wrote:
> <tomas@tuxteam.de> writes:
>
> Indeed. For untyped languages, why put the types in
> code where they aren't actually types anyway? And for
> typed languages, why put them in code where they still
> aren't types and even more, where they can indicate
> the *incorrect* type as well?

There are still reasons to use Hungarian notation, because even the
most strongly typed languages in common use are not strongly typed
enough. (Haskell is or can be persuaded to be, but my employer is not
ready to embrace Haskell.)

1: Every time I have to work with two or more coordinate systems that
use the same axis names (typically X and Y). E.g. a mathematical plane
and pixel coordinates relative to a window and/or a monitor and/or a
workspace. Eventually I start naming variables starting with “wx, wy”
for window, “sx, sy” for screen, etc.

2: Strings in different encodings. E.g. the Python (2.7) web framework
I use gives me Unicode strings, then I want to map them to filenames
and thus have to encode them to UTF-8, and later I need to send an
urlencoded header to the web server. Pretty soon Unicode strings get
the u_ prefix, UTF-8 strings get u8_, filenames from the user-provided
zip file (that are labeled in the zip file directory as cp437, but
actually are windows-1251 in most of my cases, but I can’t rely on
that and have to implement a heuristic) get yet another prefix.

3: Local and UTC times, if you are unfortunate to have to deal with them.

4: Measurements that are in neither SI nor common use units. (A
routing algorithm I used to work with had a parameter expressing the
estimated pedestrian speed. It typically had a value of 56. The unit?
Centimeters per second, of course. The common speed unit is km/h
here.)

Without carefully labeling each affected variable, after a month of
not touching the codebase, it becomes impossible to make modifications
without breaking anything.

Note that this isn’t the Systems Hungarian many people are used to,
which encodes the actual type. It’s Applications Hungarian, where
variables that have the same physical type get different prefixes
after their conceptual type.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]