On Thu, 10 Jun 1999 [EMAIL PROTECTED] wrote:

> Hi,
> 
> I had occasion to want the starting and ending offsets of a certain chunk. I 
> toyed with providing new chunklike syntax, such as 'the lineOffsets 1 to 4 of 
> it'; didn't like it; then hit upon this:
> 
> the range of line 2 to 4 of it
> 
> Which would return two offsets as comma-delimited integers. 

Not to try to outdo Ruediger or anything, but this kind of thing is
not too hard to do now:
put the number of characters in line 1 of it into myvar
put comma & the number of characters in line 2 to 4 of it after myvar

> It also works for 
> containers:
> 
> container theCont = my title
> get the range of word 2 of theCont

I don't know "containers", perhaps you could elaborate.  From the
above example, they look like "references" in C++ or Java (and it
looks like you're also co-mingling variable and property syntax, which
has been discussed on this list previously).

> It also preserves container opacity -- IE, the 'black bag' effect of passing 
> a chunk to a handler that accepts containers:
> 
> doMyThing item 3 of something
> on doMyThing container theCont
>   get the range of char 2 to 3 of theCont  -- would be "2,3", regardless of 
> what theCont really is
> end doMyThing

This looks like call-by-reference, a feature MetaCard already has,
though you can (currently) only apply it to entire variables and not
chunks within variables.  The MetaCard syntax would be:
on doMyThing @theCont

> Is there a 'range' function elsewhere in xland -- does this conflict
> in any way? I like it partly because it's friendly and doesn't
> corrupt the all-important black bag effect, partly because my
> compiler makes implementing this trivial.

The only thing I'd recommend is caution before pushing this type of
thing too hard.  In my experience, people have a lot of trouble even
grasping the concept of call-by-reference, let alone where you've got
some spaghetti code such as where one function calls another one and
both change the "chunk" that gets passed in.
  Regards,
    Scott

> Dan
> 

********************************************************
Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...

Reply via email to