----- Message d'origine -----
De : xtalk <[EMAIL PROTECTED]>
� : <[EMAIL PROTECTED]>
Envoy� : lundi 6 septembre 1999 11:13
Objet : xtalk V1 #316
>
> xtalk Monday, September 6 1999 Volume 01 : Number 316
>
>
>
> In this issue:
>
> xTalk: User handlers with xTalk syntax
>
> ----------------------------------------------------------------------
>
> Date: Sun, 5 Sep 1999 13:26:07 -0600 (MDT)
> From: Scott Raney <[EMAIL PROTECTED]>
> Subject: xTalk: User handlers with xTalk syntax
>
> Something that's always puzzled me about xTalk development is the lack
> of interest people seem to have in having their own handlers or
> externals support an English-like syntax like the built-in commands
> have. SuperCard seems to allow this, while HyperCard, OMO, and
> MetaCard do not. Even so, I've never seen this listed as one of the
> advantages of SuperCard over HyperCard.
>
> Does anyone ever make use of this feature? If not, why not? If so,
> are there any problem areas? One thing I can think of is that you'd
> have to be very careful about is using any built-in operators as
> "syntactic sugar". Should it try to evaluate them, or should it just
> pass the tokens literally in some situations? Take for example:
>
> mycompare somevar with someothervar # 4 separate params
> mycompare somevar is someothervar # only 2 params
>
> ********************************************************
> Scott Raney [EMAIL PROTECTED] http://www.metacard.com
> MetaCard: You know, there's an easier way to do that...
>
> ------------------------------
>
> End of xtalk V1 #316
> ********************
1) ENGLISH-LIKE IS NOT ALWAYS BETTER ...
xTalk do not contain only "english-like" syntax, it contains also "()" syntax.
I have to write anyway
get offset(x,xx)
get sqrt(x)
get within(button "ok",the mouseLoc)
so why not
get myCompare(x1,x2)
It is important to speak english-like when it is easier to write or to read ;
but sometime that's not the case.
For example the english-like "get the property of object anObject" is okay.
Or "if there is a button "feedMe" then send "eat 2 carrots" to button "feedMe"
is okay.
The non english-like "get aFunction(paramList)" is okay.
But functions without parameters called like properties are confusing.
I offen write (bad) things like
"get the selectedText of field myField"
"put the hilitedLines into mySel"
because there is no logical way to remember that "the selectedText" is a
function and "the hilitedLines" is a property.
So more english-like is not always usefull and can even be counterproductive.
2) BUT MORE XTALK WOULD BE BETTER
For me it is less important to share or re-use functions or handlers than to
share or re-use structured data or custom objects (like most of xtalk-user, i am
more an author than a programmer, so i want to share contents or interactive
experience).
Suppose i want to build a spreadsheet-like object (or any kind of object
containing data and interactivity). I can assemble in a group a hidden field to
contain my data, a display field to show a part of the data, an other field on
top to edit the content of a cell, one or two scrollbars, plenty functions...
I'll name this group "group spreadSheet". I can put in the script of the group
lot of setprop and getProp handlers to manage the properties of my spreadsheet.
I can even clone the group and modify it.
But i can not write
create spreadSheet
set the name of it to mySpreadSheet
set the loc of spreadSheet mySpreadsheet to ...
In fact my group is not recognized by Metacard as a true object. I am very sad
and frustated about that !
Omo had such a feature, but the objects had to be written in C. I dont have the
time to put my hands in C, C++ or Java, but "you know, isn't it an easier way to
do that..." :-)
Obviously a great progress would be to allow programmers/authors to build their
own objects in xTalk.
In the past to extend xTalk, we had xFunctions and xCommands ; there were 3
arguments for compiled xfcn and xcmd :
- it is compiled, so it is fast
- it is compiled, so nobody will see your code
- it is written low-level to act at the system-level
The 2 first arguments are becoming more and more obsolete :
- computer and xtalk are very fast today
- some xThing programmers are opening their code (cf Fourth World)
Of course, the last argument remains true and system-level interactions are not
for xtalk programmers (thanks we have Metacard corp. and Tuviah Snyder to do it
for us ...)
So why not have a standard way to write xObjects or xWidgets in xTalk ?
Today there are only a few stacks shared among the metacard-community. I do not
use the stacks proposed by other because there is not standard way to
incorporate this stuff into my apps. And i do not try to share my code, not
because i am not ready to share, but because my objects or my data structures
can not easily be separated of my stacks.
3) HOW TO BUILD XOBJECTS IN XTALK
Metacard has a nice feature with the templateXXX() functions.
set the style of the templateGraphic to "oval"
create graphic
the name of it to "myOval"
Could it not be possible to prepair in a stack "myWidget" a group "myWidget" and
to include this group as a substack (or a component) in the mainstack and to be
allowed to write in xtalk :
set the anyProp of the templateMyWidget to anyValue
or
set the anyProp of template(myWidget) to anyValue
create myWidget
set the name of it to ...
A problem i see is that today there are setProp and getProp handlers only for
custom props.
Obviously a widget would need setProp and getProp handlers for all the standard
properties.
That's all for today, because i am going farther than what my programming skills
and my english allow :-(
Just to resume, what is better :
"User handlers with english syntax" or "user objects with xtalk syntax" ?
----------------------------
Claude Lemmel / Opus species
email : [EMAIL PROTECTED]
website : www.opus-species.com
------------------------------