From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Check for redundancy
Date: Mon, 29 Jun 2015 01:47:04 +0200 [thread overview]
Message-ID: <87si9bl7k7.fsf@nl106-137-147.student.uu.se> (raw)
In-Reply-To: 877fqnpl7h.fsf@robertthorpeconsulting.com
Robert Thorpe <rt@robertthorpeconsulting.com> writes:
> Just because there aren't types doesn't mean that
> variables don't have types. What "untyped" means is
> that the language doesn't enforce typing for you.
> That makes it more important that you manage them
> carefully for yourself.
... are you sure?
In C, you do
int five = 5;
In Lisp (Elisp), you do
(let ((five 5)) ...)
If you want to, you can do (integerp five) but there
is seldom a reason to do that unless you are into
verifying indata. In my experience, you don't have to
do that because such errors will implicitly be brought
to day all but instantly when data is put to use.
Only cool use of such "type" checks are DWIM functions
where you can pass say either a char or a string and
it will put it together differently but produce
a consistent (transparent) result. Note that if those
args were explicitly typed, or HN-typed, that would
not work (unless some HN notion for char-or-string was
invented).
Maybe the variables values have types at runtime but
not necessarily the variable *names* at coding time,
which is when you'd prepend the HN-designation.
In C, tho typing is explicit at declaration, which
would seemingly hand over the responsibility to the
compiler, there is still incomparably more mucking
around with types - explicit and implicit casts,
(void) pointers - typically on first compilation you
get a bunch of this kind of errors (and warnings), all
about types many panes ahead!
So in this case it is the other way around - in C,
having types explicit doesn't reduce "type work", but
instead it is there tenfold, while in Lisp, not
bothering with that makes for not having to do any
of that.
Besides, I don't think of (integerp five) as checking
the "type" in a compiler sense, I think of it as
checking what's there in a human sense much like
looking into a bucket to see what's there so to decide
what to do with it.
> I agree with Yuri Khan that it's useful in other
> situations. Khan's examples depend on how broadly
> you treat the word "type". Khan is treating things
> as types that you don't think of as types, his
> definition is a bit broader than yours. There are
> arguments for both ways of looking at things.
>
> Another thing that it's useful for is
> differentiating a type from instances of a type.
> For example, many people use "something_t" as the
> type and "something" as the instance. I prefer to be
> more specific, e.g.: "something_s" for a struct and
> "something_e" for an enum.
Yeah, I think there is a misunderstanding where you
think I say you cannot mention types, encodings,
units, etc. ever in variable names, i.e. you should
never name something in terms of technology.
That isn't so; I agree there are such cases when that
is called for.
However, the way I understood HN is that you should
*always* use prefixes like that. What I remembered it
looked like this:
intMoney = 0;
strGreeting = "Stay a while, and listen!";
And I don't see any reason to do that.
--
underground experts united
http://user.it.uu.se/~embe8573
next prev parent reply other threads:[~2015-06-28 23:47 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-24 9:29 Check for redundancy Andreas Röhler
2015-06-24 13:23 ` Drew Adams
2015-06-24 14:55 ` Andreas Röhler
[not found] ` <mailman.5580.1435157733.904.help-gnu-emacs@gnu.org>
2015-06-24 18:21 ` Stefan Monnier
2015-06-24 21:10 ` tomas
2015-06-25 3:23 ` Stefan Monnier
2015-06-25 7:47 ` tomas
2015-06-26 15:01 ` Emanuel Berg
2015-06-26 20:25 ` Marcin Borkowski
2015-06-26 22:48 ` Emanuel Berg
2015-06-27 12:11 ` Robert Thorpe
2015-06-27 13:12 ` tomas
2015-06-27 23:02 ` Emanuel Berg
2015-06-28 11:07 ` tomas
2015-06-28 15:50 ` Emanuel Berg
2015-06-28 16:35 ` Yuri Khan
2015-06-28 20:03 ` Emanuel Berg
2015-06-28 21:38 ` Robert Thorpe
2015-06-28 23:47 ` Emanuel Berg [this message]
2015-07-02 23:37 ` Robert Thorpe
2015-07-03 3:36 ` Yuri Khan
2015-07-03 6:41 ` Eli Zaretskii
2015-07-03 11:48 ` Yuri Khan
2015-07-03 12:16 ` Eli Zaretskii
2015-07-03 22:59 ` Robert Thorpe
2015-07-03 6:09 ` tomas
2015-07-03 19:56 ` Emanuel Berg
[not found] ` <mailman.6215.1435903802.904.help-gnu-emacs@gnu.org>
2015-07-03 6:38 ` Rusi
2015-07-03 7:54 ` tomas
2015-07-03 8:55 ` Loris Bennett
2015-06-24 23:31 ` Emanuel Berg
2015-06-25 2:03 ` Óscar Fuentes
2015-06-25 2:07 ` Emanuel Berg
2015-06-25 2:53 ` Óscar Fuentes
2015-06-25 3:21 ` Emanuel Berg
[not found] ` <mailman.5603.1435188769.904.help-gnu-emacs@gnu.org>
2015-06-25 7:43 ` Stefan Nobis
2015-06-25 8:52 ` Andreas Röhler
2015-06-26 14:51 ` Emanuel Berg
2015-06-26 14:39 ` Emanuel Berg
[not found] ` <mailman.5719.1435329683.904.help-gnu-emacs@gnu.org>
2015-06-27 7:40 ` Stefan Nobis
2015-06-28 2:02 ` Emanuel Berg
2015-06-28 2:40 ` Emanuel Berg
[not found] <mailman.6209.1435880273.904.help-gnu-emacs@gnu.org>
2015-07-03 8:40 ` Pascal J. Bourguignon
2015-07-03 20:04 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87si9bl7k7.fsf@nl106-137-147.student.uu.se \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.