Title: FreeCode Signature
I am a little bit wary about the number of different types of braces and parens in modern expressions, and how their usage compares to other languages.

In Python, () are used for function calls and tuples (read-only lists), [] are used for lists and {} are used for mappings (assoc-lists).
In C, () are used for function calls, [] for arrays (lists) and {} for structs (sort of like read-only assoc lists).

A very different approach to infix notation could be to not use special parenthesis, but a macro and a special symbol. The macro would enable infix for the _expression_ and for all sub-expressions, except ones prefixed with the special symbol.

Together with the "term-prefixing" feature and a carefully choosen macro name, this could work and feel very similar to backquote/unquote:

if ^((foo + 3) > (nana * ,(foo (fie naja hehe))))
   ....

This would be read (using term-prefixing) as

(if (^ (foo + 3) > (nana * ,(foo (fie naja hehe)))) ...)

It would also be interresting to implement the Pythonic list features, e.g. slices and slice assignment. Extra points for implementing both a destructive and a non-destructive version. E.g.

let
  group
    a b[1:5]
    c d[0:3,x,5:7,9:]

The syntax could be:

list[range|variable,range|variable...]

where range would be integer:integer. 0 would be the position before the list, -1 the position after the list (this is different from Python, but this is a misfeature in Python).

Definition:

x[a] is the same as a
x[a:b] is the same as (slice x a b)
x[EXPR,c:d] is the same as (append x[EXPR] x[c:d]), e.g. x[a:b,c:d] is the same as (append x[a:b] x[c:d])

define
  slice x a b
  if (> a 0)
    slice (cdr x) (- a 1) b
  if (> b 0)
    cons
      (car x)
      slice (cdr x) a (- b 1)
  '()


--
Konsulent, Fri Programvare / Free Software Consultant
Cell: +47 - 91 17 05 93
Phone: +47 - 21 53 69 00, Fax: +47 - 21 53 69 09
Addr: Slemdalsveien 70, PB 1 Vinderen, 0319 Oslo

 Free beer costs nothing, freedom costs a fight.
 Free beer lasts an eavening, freedom lasts a lifetime.


Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to