Have you seen this? http://harmful.cat-v.org/software/OO_programming/
--
matt kane's brain
http://hydrogenproject.com
Look at some of the talks given about the motivation behind Go. In
particular, there is one titled "public static void" by Rob Pike,
which seems to be pertinent to your question. Most of the talks
(though not the one I just cited) are linked at
http://code.google.com/p/go-wiki/wiki/GoTalks .
--Benny.
--
The first essential in chemistry is that you should perform practical
work and conduct experiments, for he who performs not practical work
nor makes experiments will never attain the least degree of mastery.
-- Abu Musa Jabir ibn Hayyan (721-815)
Language X was not naturally recursive, yet many algorithms were
written recursively with explicit stack management. (X = Fortran, ...)
Language X lacks "OO" as a check item, but programmers can readily
code in an OO way in any language, and of course CFRONT showed that C
could have feature-rich "OO."
Feature Y (bounds checking, list-structure, SNOBOL/Icon inbuilt
pattern matching, dynamic allocation, GC, ...) can be built in or
added on.
Concept Z ('bounds checking") can be implement noisily with "a[i] ==>
{t = iExpression; if t is in bounds r = a[t] else r = ...}" as a macro
or a preprocessor or a well-implemented habit.
Design approaches can also be manufactured. I want to program with
generators or continuations. I write my function with all state as a
struct element, I allocate such a state for a new function call,
process, and return result and pointer to state, ...)
I don't need Go for asynchronism -- not only do pthreads work but the
whole of Go's asynchronism can be built for C using a library.
So the real question is about paradigms of program, data, or process
organization--what are their benefits in various cases and what are
the weaknesses. The secondary question is about what languages make
these paradigms more or less easy or clear to express, debug, or
maintain across various scales of problems in terms of data size,
performance, or developer community.
For example, it is surprisingly easy to build an automatic
differentiator or anti-differentiator for numerical functions
expressed in a functional means--I mean tools that transform the
program source to compute the desired function. Iverson was able to
differentiate a rich set of APL functions using an 8 or 10 line APL
function. That is a stunning thing and if you wanted to do that on the
fly then that advocates for expressing your code in a FP manner. (Tiny
example of a huge field byt still, a valid one.)
I'd like to see an analysis of approaches first and then a discussion
of implementations secondarily. To be clear, Go's interfaces are
certainly OO to me, even though they lack most every expression of
OO-ness from every OO-themed language. The ability for a common set of
actions to be understood by a class of programmatic objects (they can
all print themselves, they can serialize, they can ...) is a greatly
simplifying design approach. It is a good thing to do. However, what
to do and how to do it are orthogonal. One way is to say that anything
C and D have in common is inherited from their ancestor A. This can
make D's ability to also do what B can do an awkwardness. In Go, with
zero "you are who your parents made you" we have "you are what you say
you can do", an individual meritocracy. If fact, you "are" every class
that you match so you might even match interfaces not yet written.
This is subtle and deeply important, yet, must we say that Go is
against OO and all the flaws of OO languages?
Saying this (in a book) means talking about shared traits as a concept
and parent-child bestowing of traits as a different concept then
showing how some languages links of these two concepts to implement
"objects", some keep them apart, some, like Go, don't have the notion
of parent at all but they do have the notion of DNA borrowing by
embedding as well as arbitrary DNA equivalence by subsetted interface
signature matching.
Just a thought, but you might want to be clear about this.
--
Michael T. Jones | Chief Technology Advocate | m...@google.com | +1
650-335-5765
> I watched that talk, I will do it again but with more focus on what he says
What about pure "Functional Programming"?Is it perfect?
There is nothing particularly wrong with functional programming.
Obviously many of the ideas from functional programming have been
adopted into other languages, including Go.
However, pure functional languages have been around for many years and
none have been widely adopted. Personally I think this is because pure
functional languages are a poor fit for the way that programmers
actually think about solving problems. We live in a world in which
things change, and we are accustomed to that; pure functional languages
live in a world in which nothing changes. Also, pure functional
languages are a poor fit for the problem domains that most programmers
have to work in, e.g., user facing applications. Interacting with the
user is difficult in a pure functional language, and generally requires
breaking the purity. We wind up with approaches like Haskell's monads,
which are notoriously difficult for most programmers to understand.
Go is not a pure functional language because the initial conception of
Go was to use it to write system level programs like web servers and
databases. These sorts of tools are not written in pure functional
languages. It would not be impossible to do so, but it would be
difficult and awkward. In particular it would be hard to make the
result highly efficient; one of the advantages of Go over some other
languages is close control over memory layout and usage, a feature that
is very difficult to provide in a pure functional language.
Of course there are examples of non-pure functional languages that are
entirely suitable for systems programs, such as Erlang or, arguably,
Scala.
Ian
> Just one more question.. I thought that Scala was kind of an hybrid
> language (OO, imperative +FP) , just like Go but with more features
> towards, for instance, enforce inmutable data somehow as pure FP dictates.
> Is that right?
I believe that is correct, although I can't claim to fully know Scala.
Ian
FP: http://www.stanford.edu/class/cs242/readings/backus.pdf
FL: http://theory.stanford.edu/~aiken/publications/trs/FLProject.pdf
You might want to read Dijkstra's review of FP. Harsh in his way but cogent:
http://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD692.html
One of my favorite languages is J, the intellectual heir of all that
is/was APL. J has a strong sense of FP in it, especially when you get
into Tacit expressions. This "essay" discusses them but does so in the
manner of English Cricket, which only makes sense to those to whom it
previously made sense:
http://www.jsoftware.com/jwiki/Essays/Tacit%20Expressions
If you're intrigued, then read the beautiful guide by my friend, the
great Henry Rich. It is in section 36 of his book J for C Programmers
(included with J and linked from here in Word and PDF form:
http://www.jsoftware.com/jwiki/Books)
There is another language within J, a microcode for J as it were.
Like Moliere's M. Jourdain, who was astonished to find he had been
speaking prose for forty years without knowing it, you have been using
a small subset of this language unwittingly throughout our
investigations. The hidden language describes a way of coding called
tacit programming, and it is time for you to learn it in full. J's
tacit language is the irreducible essence of a programming language.
It describes your algorithm using only the ordering of the J
primitives you have already learned. It has a grammar without words,
which you use to write programs without visible operands; yet its
renouncing these seemingly essential components is self-denial rather
than self-mutilation, for it retains the vigor to express any
algorithm. It is as evanescent as the breeze and as powerful as the
hurricane. It is a sublime creation.
It is very educational to learn J and from that you will see what
Backus wash talking about.
--
josvazg writes: