[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Syntactic conventions
- From: Coda Highland <chighland@...>
- Date: Sat, 26 Apr 2014 19:14:42 -0700
On Sat, Apr 26, 2014 at 3:57 AM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> The trouble with using words like "noun" and "verb" and so on, is
> that all human languages (as far as I know) adopt a first order
> logic. By that I mean a two-tier system, the lower tier for
> "passive" objects, the upper tier for "active" objects that can
> transform things in the lower tier.
True enough, but there's also a construction for demoting "active"
objects to "passive" objects, specifically for the purpose of acting
on them grammatically (gerunds/infinitives), and a construction for
promoting "passive" objects to "active" ones, although the semantics
of such an operation aren't universally defined (I don't know what
this is called).
For example, I can say "I like to run." (or "I like running.") and in
doing so I've converted a verb to something that I can treat as a
noun. In a sense, this is reflected in C, where you can't pass a
function but you can pass a pointer to a function.
But this is where programming languages prove that they're not
context-free even if a context-free grammar can parse their syntax.
Let's return to Lua, where "function pointers" aren't a special
construct. "x()" is legal syntax for any identifier x. But even though
this syntax is accepted by the parser, there are higher-level rules
(just like in natural languages) that determine whether this
construction is actually valid.
>> Programming languages have noun class systems too! Syntax and
>> inflection vary based on whether you're accessing a scalar, an array,
>> or an object.
> This is not true in Smalltalk, since there is no distinction between
> those. The most you could say is that lvalues are magically unboxed
> when not on the left in an assignment statement, but that's true
> everywhere but shells and Tcl.
So you're telling me that I can index into a floating-point number, or
add two arbitrary objects together, and always have it be well-formed
at runtime? That's the point I'm making -- sure, the formal grammar
will allow it, but that doesn't change the fact that Smalltalk, like
every other programming language, has operations that are valid on
some classes of nouns but not on others.
/s/ Adam