Comments: |
О, а нельзя ли обосновать? (это не значит, что я сомневаюсь, это значит, что я хочу понимать, почему, а заодно прояснить, правильно ли я понимаю слово separator))
Ну и, чтобы два раза не вставать - не знаете ли Вы хороший текст о том, как должен быть в идеале устроен синтаксис ЯП, какие факторы надо учитывать и т.д.?
lexems/literals/atoms/whatewer are already separated on lower level -- this is why.
is (a, b, c) any better comprehensible than (a b c)
separators add nothing to syntax. they are meaningless. look:
list ::= . list ::= member separator list. list ::= member list.
separator is equivalent to its absence
even WORSE it will be if you attempt to inject some sense into separators (see erlang for example) in this case they will become a surrogate of parenthesis, and that is really ugly.
In lisp-like languages yes. But even in lisp-like languages, I think, default values and parameter passing by name is good feature. But read parameter passing by name, having no separators, is difficult.
you mean you need separators to separate sublists within a list... what i said about parenthesis.....
I don't really need them. But it is easier to read ls(all = true, long = false) than ls(all@true long@false) or something like that.
(ls is function with parameter list as in unix ls command)
in sql-2.0 similar structure is written as (book (author person) (issue timestamp)) or (foo (all true) (long false))
Parameter binding and function invokation are different ideas and I want to see difference on syntactic level. Your syntax makes sense, if we will use other square or curly brackets... but number of bracket forms is small ("()","{}","{}"). Or, maybe, we can use (foo @(all true) @(long false))... Yes, makes sense.
no: (foo @(all true) @(long false)) yes: (foo (@ all true) (@ long false))
@ -- operator of parameter binding, at first glance.
you can even think of it as a slightly perverted set-comprehension
(foo (= all true) (= long false))
where all members subsequent to "foo" constitute a predicate and are implicitly connected by "AND"
also there is no harm in allowing operator to appear at second position in any invocation (as well as in the first position)
IF !!! you have an "operator" term as opposed to "name" term
it is controversial, but i think it is a good idea, at least it is good for readability.
also they add some pain while during machine writing: say we want to compose a list written as a string:
a := "" a := a ++ "," ++ Item
we got: ",1,2,3" which is a syntax error
a := "" a := Item ++ "," ++ a
we got: "1,2,3," which is a syntax error again
and everybody see that this "error" is not en error, any compiler could swallow easily -- yet it is out of _HUMAN_ idea of separators.
so that separators MAKE ANY LIST NON-HOMOGENOUS -- tail element is exceptional.
imagine how many lines of code in this world dedicated to the only purpose to serve this exception.
Yes, but it is easy to fix by 1 function (it can be inline or macros).
"TO FIX"???? we are definitely unclear here. you either have to think, or you are beyond hope
a := "" a := my_join(a,Item,",");
my_join(word,suffix) := if (word == "") suffix else if suffix == "" word else word ++ separator ++ suffix;
listen to yourself!
-- no! no! it is not broken!!! we can fix it!!!
no-no-no! It is really broken (I've said "yes"), but it is easy to fix one time and forever.
ok. it is broken. are u going to create yet another broken lang?
Excuse me... I've lost one parameter in description of my_join()
a := "" a := my_join(a,Item,",");
my_join(word,suffix,separator) := if (word == "") suffix else if suffix == "" word else word ++ separator ++ suffix;
vse horoshie teksty tut: file.bestmx.net/ee/articles
ideal syntax is slightly approached in /ee/articles/SQL-2.0/*
also a simpler case -- a data serialization language with ideal syntax is located in /ee/software/urt
| |