[erlang-questions] Controversial subject of the day: tabs and spaces for indentation

Richard A. O'Keefe ok@REDACTED
Mon Feb 10 23:26:08 CET 2014


On 7/02/2014, at 8:39 PM, Jarimatti Valkonen wrote:
> I've been having this idea in my head about something similar to a Smalltalk system browser, but for Erlang. Useful? I doubt it, but at least it would be an interesting experiment. A source editor is doable, but making it work on a live system is left as an exercise to the reader. :)

I had the same idea about Prolog at one point.

For the benefit of people who haven't used Smalltalk,
the basic browser interface is the "five pane browser".

	+---------+---------+---------+---------+
	|list of  |list of  |list of  |list of  |
	|groups of|classes  |groups of|methods  |
	|classes  |in group |methods  |in group |
	+---------+---------+---------+---------+
	|a bunch of buttons                     |
        +---------------------------------------+
        |edit window for class description      |
        |or class comment                       |
        |or method definition                   |
        |or for showing output of a tool such   |
        |as a lint checker                      |
        |                                       |
        +---------------------------------------+

A "class category" is roughly like an application in Erlang.
A "class" is roughly like a module in Erlang.
A "method category" is a named group of semantically
related functions, e.g., methods for comparing, methods
for printing, methods for iteration, &c.
A "method" is roughly speaking a named function.

There are several more or less specialised versions of this
and you can have any number of them on screen tat the same
time.

Modern Smalltalks also have things we might call "package
browsers" and/or "repository browsers" for locating,
inspecting, and possibly installing add-on packages that
are not loaded by default and might be held remotely.

The "class categories" and "method categories" are
programmer-selected names for groups of things that
are managed by the programmer.  These properties are
available for query (and update!) by running code,
but have no other effect on execution semantics.
Methods may be further classified semantically by adding
"pragmas" to their source; this may be reflected in the
way the method's name is display, and is accessible as
run-time data.

This is a really good way to get to know an unfamiliar
class one method or one facet (method category) at a
time.  It can be a pain in the backside when you are
trying to understand the interactions of several methods
at once.

It can also be a bit awkward when you are trying to
ensure that the definitions of a method in several classes
are semantically consistent; then you want to slice by
method rather than class.  Fortunately, Smalltalk IDEs
often have some sort of "method finder" that lets you
find/pick a particular method name and get a list of all
the classes that implement it.  (It is really annoying the
way VW closes that list as soon as you pick one element.
Squeak gets that right.)

I think perhaps there are two key ideas that could be
adapted to the Erlang world:

 - programmer defined indexing terms for modules and
   for functions, so you could say "what are some
   modules or functions that are *about* this topic"
   whatever they might be named.

   Perhaps
	-index([ List of strings ]).
   before the first -export: relating to the module;
   after the last function: relating to the module;
   elsewhere: relating to the next function.

 - having multiple ways of viewing the code base,
   slicing by module or function or data type or whatever.


   elsewhere:
E
> 


> Is anyone aware of anything similar?
> 
> And yes, I don't see this solving the tab/space indentation discussion.




More information about the erlang-questions mailing list