| Store | Cart

Re: [TCLCORE] TIP #461: Separate Numeric and String Comparison Operators

From: Dipl. Ing. Sergey G. Brester <seb...@users.sourceforge.net>
Wed, 01 Feb 2017 19:45:32 +0100
 

There's already available - its name is tcl-parser and tcl-compiler. 

But you forget, that tcl is dynamical language, so some things to be
evaluated (and parsed) only at execution time. And sometimes the
compiling/parsing takes place on demand and not necessarily in expr, if,
etc.

Whats about:

if {[[$obj exec [build {
 select * from [$orm getTable {$FIELD == "TEST"}]
 where ...
}]] == "0"} {...}

What do you see here? What is {$field == "test"}, but especially what
returns "$obj exec"? It is always a number?
Why it would be wanted behavior? (hint: empty for NULL, empty for not
found, and many many other things).
What occurs if we'll change or extend it tomorrow, so the class of $obj
becomes tomorrow other engine-possibility with similar interface, but
returns numbers here (but the original engine returns as before string
or vice versa).

Or something like sqlite in tcl:

$db eval {.. very large and complex statement ... $A == {...} ... }

What do you see here? It is some prepro (aka prepared args)? Or "$db
eval" does "subst" internally? Or it's a part that will be LEGAL
COMPILED INTERNALLY (TRANSIENT ON DEMAND) TO SOME LEGAL TCL-EXPRESSION?
Or someone have defined own operand "==" in own sql-syntax (or it is
even nosql-syntax). 

Just another one: 

set expr1 {$A $OP $B}; ... ; myEvaluate $expr1 $op $a $b

AND ESPECIALLY - HOW YOU WANT GENERALLY TO DIFFERENTIATE BETWEEN TCL AND
NOT TCL, namely SQL, NoSQL with expr-support, Tcl+Other mix,
pre-processors, that will be executed before tcl (and not with Tcl), on
demand compilation to expression or dynamically scripts, etc?

If you can use such parser, good luck... BUT I AND MY COLLEAGUES CAN
NOT. 

Regards,
sebres. 

Am 01.02.2017 18:48, schrieb Peter S: 

> A simple "operator validator" program, nothing serious, done in 20 minutes...
 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core

Recent Messages in this Thread
Donald Porter Jan 31, 2017 05:09 pm
Peter S Jan 31, 2017 09:45 pm
Brad Lanam Feb 01, 2017 12:04 am
Kevin Kenny Feb 01, 2017 01:09 am
Brad Lanam Feb 01, 2017 01:26 am
Dipl. Ing. Sergey G. Brester Feb 01, 2017 07:57 am
Peter S Feb 01, 2017 01:13 pm
Peter S Feb 01, 2017 01:23 pm
Colin McCormack Feb 01, 2017 02:33 pm
Peter da Silva Feb 01, 2017 04:16 pm
Peter S Feb 01, 2017 04:27 pm
Peter S Feb 01, 2017 04:41 pm
Peter S Feb 01, 2017 05:10 pm
Peter S Feb 01, 2017 05:48 pm
Dipl. Ing. Sergey G. Brester Feb 01, 2017 06:45 pm
Peter S Feb 01, 2017 06:48 pm
Peter S Feb 01, 2017 10:07 pm
Peter S Feb 01, 2017 10:30 pm
Brian Griffin Feb 01, 2017 10:48 pm
Dipl. Ing. Sergey G. Brester Feb 01, 2017 05:11 pm
Peter S Feb 01, 2017 04:13 pm
Martin Lemburg Feb 01, 2017 03:31 pm
Martin Lemburg Feb 01, 2017 12:20 pm
Dipl. Ing. Sergey G. Brester Feb 01, 2017 01:20 pm
avl Feb 01, 2017 12:01 am
Donald G Porter Feb 02, 2017 06:21 pm
Peter S Feb 01, 2017 10:59 pm
Dipl. Ing. Sergey G. Brester Feb 02, 2017 08:29 am
avl Jan 31, 2017 05:04 pm
Peter S Jan 31, 2017 05:13 pm
Messages in this thread