HN user

sttaft

11 karma
Posts0
Comments5
View on HN
No posts found.

For what it's worth, the ParaSail parallel programming language (https://github.com/parasail-lang/parasail) supports this:

    func Search(Root : Tree; Desired_Value : Tree_Value)
      -> optional Tree_Id is   
        var Identifier : optional Tree_Id := null;
 
        for T => Root then Left(T) || Right(T)
          while T not null concurrent loop
 
           if Value(T) == Desired_Value then
              // Found desired node,
              // exit with its identifier
              exit loop with Identifier => Key(T);
           end if;
 
        end loop;
 
        return Identifier;
    end func Search;
I actually don't use this feature much, because usually there is a key of some sort that determines which side of the tree is of interest.

For what it is worth, Ada was not "designed by committee" more than most languages. It was designed by a design team, and in each revision, there was a strong technical leader of the design team, with the whole design team sharing a strong design aesthetic. I doubt you could say even that about many mainstream languages these days.

There is no doubt that ParaSail syntax is verbose, mainly because it was designed more with readability than writeability in mind. But knowing how strong are the feelings about syntax, we actually designed four different parsers (all of which are included in the downloadable release). The one we use normally is the one we wrote about, and is the most oriented toward readability. The other three have somewhat winsome names and presumably obvious connections to Python, Java, and SPARK: Parython, Javallel, and Sparkel. In fact, the ParaSail parser permits the use of Python-like syntax, with ":" instead of keywords like "then" or "loop" and no "end blah" (so long as the indentation is all copacetic), and "def" instead of "func" -- hence:

  def Sum_Of_Squares(N : Int) -> Int:

    return (for I in 1 .. N => <0> + I ** 2)
is legal ParaSail syntax. Parython uses a syntax similar to this, but with the "for loop" syntax re-arranged a bit to better match existing Python syntax.

So the hope is for folks to look a bit beyond the surface syntax, and consider the underlying semantic model, which is hopefully where the more interesting issues reside in any case.

-Tuck

ParaSail is designed to be easily understandable and usable by programmers familiar with languages like Java, C#, Modula-3, Eiffel, etc., while providing implicit parallelism and full compile-time checking of all user-written annotations as well as all language rules (such as no use of uninitialized or null data, numeric overflow, array out-of-bounds, race conditions, etc).

ParaSail is also designed to be simpler than many current languages in its basic module/type/object model. As part of that it eliminates re-assignable pointers, explicit storage allocation, explicit storage reclamation, garbage collection (it uses region-based storage management), run-time checking (it does it all at compile time), and run-time exceptions. Finally, there is no special syntax reserved for built-in types -- any appropriate type can support indexing (e.g. A[I]), slicing (e.g. A[1..5]), operators (+, -, <, >, +=, *=, ...), literals (e.g. X += 25), intervals (X..Y), aggregates (Map |= ["key1" => Value1, "key2" => Value2]), iterators (for each [Key=>Value] of Map concurrent loop ...), etc.