[Self-interest] Fwd: Toward Declarative Programming

Adam Spitz adam.spitz at gmail.com
Wed Apr 22 12:38:09 UTC 2020


I agree that "copy and mutate" sounds like it might not be compatible with
declarative programming, but I think there are deeper psychological
principles that make Self worth understanding even if you don't want
imperative programming.

I don't know whether you've heard the prototype spiel before, and Dave and
various others here can do it better than I can, but:

Part of the motivation behind prototype-based languages is that when human
beings come up with categorization systems that feel intuitive, they
usually don't really look like "here are the properties that are shared by
every member of this category"; they look much more like "here are some
properties that are typically shared by the more-central members of this
category, most of the time; membership in the category is fuzzy, and varies
depending on how similar the thing is to the central examples of the
category; we define things by describing how they're different from other
things." (George Lakoff makes the case for this in Women, Fire, and
Dangerous Things.)

For example, here are some observations about the way humans categorize
things:

  - A robin is a better example of a bird than an ostrich is. (Membership
gradience - some examples are more central than others, and people
more-readily identify the central examples as belonging to that category.)
  - Most humans have ten fingers, but a few don't, and they probably still
qualify as human. (Family resemblances - not all properties are shared.)
  - If someone shows you a picture of a tabby cat and asks you what it is,
you say "cat", not "animal" or "tabby". (The most cognitively-basic part of
the abstraction hierarchy is somewhere in the middle, rather than the top
or bottom.)
  - etc.

(Of course, human beings also came up with the more-rigid categorization
systems that are used in most of mathematics, and those systems still
sorta-kinda count as categorization systems, despite not having all of the
properties that the more-typical categorization systems have. ;))

I'm not saying that you *can't* find some way to represent those kinds of
qualities in a class-based language like Smalltalk or a type-theory-based
language like Haskell; I'm just saying that these considerations are (as
far as I've seen) not even really on the radar of people who talk about
those languages. (Which isn't to say that Self does it perfectly. I don't
think Self - or any other prototype-based language that I know of - fully
captures the flavour of the categorization model that Lakoff describes. But
Self's "you make new things by copying and modifying existing things" is
meant to be a step in that direction. It's something that the Self people
have spent some time thinking about.) If you buy Lakoff's theory, there's
something in human psychology that isn't a good fit for the kinds of rigid
categorization systems used in existing declarative languages like Haskell.

With that said, I've spent the past few years learning about Haskell and
functional programming and type theory and category theory and proofs and
various other things that I used to consider icky, and I like it very much.
I'm convinced that it's usually a very good idea to avoid imperativeness
and mutation as much as possible, and I'm convinced that there's a huge
amount of value in the kinds of mathematically-precise abstractions
(functors, monads, algebraic data types, etc.) that are used in those kinds
of languages, and I'm convinced that type systems are much much more-useful
and less-awful than I believed back when the only typed languages I knew
were C++ and Java. I wouldn't be happy going back to a dynamically-typed
imperative language like Self (though I do desperately miss the Self
environment). But I think there are some insights about human psychology
that the Self people understand better than the Haskell people.

I'm not sure about this part, but I don't think those psychological
insights are fundamentally incompatible with declarative programming; I
just think it's the kind of thing that the declarative-programming world
hasn't spent a lot of time focusing on. So, yes, I think there's a lot in
Self's classless outlook that could light the way toward creating a better
declarative language.




On Tue, Apr 21, 2020 at 11:52 PM Jack Waugh <tzh9741mq402 at sneakemail.com>
wrote:

> As I understand it, the Self language uses imperativity all the way down
> to its fundament. In particular, I believe the usual (and only?) way to set
> up an object is to clone an existing one (the prototype) and then mutate
> one clone. I don't see anything about the language, nor more generally
> about a classless outlook, that would light the way toward creating a good
> declarative language. Am I missing something?
>
> Jack WAUGH
> _______________________________________________
> Self-interest mailing list
> Self-interest at lists.selflanguage.org
> http://lists.selflanguage.org/mailman/listinfo/self-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20200422/c71dc61f/attachment.html>


More information about the Self-interest mailing list