[Ohrrpgce] thoughts about slice handles

S'orlok Reaves sorlok_reaves at yahoo.com
Wed Jan 14 22:11:40 PST 2009


> Another option is to just make a couple commands like: 
>  create string slice(stringID)
>  update string slice(stringID)
I know this is way beyond the context of this email chain, but is it possible, given an ID, to detect if this is an old-style string ID or a new-style slice ID, and then pass it to the appropriate function automatically? 

I know that your original idea could do this, but I dis-liked the large indices (although I understand your use of them, now). What about creating a new "type" in the HSpeak bytecode:

Kind "1" is (already) for numbers.
Make kind "8" be "slice IDs", or "handles". 

It seems like slices are going to be a huge, completely separate part of your infrastructure, so why try to multiplex them onto the "number" type, where they just add confusion? Moreover, this allows you to have a middle layer between handles and their internal representation, so that you can change from a big array to a linked list, to an array of linked lists (or whatever) without worrying about breaking existing code. 

You'll need a little bit of syntax for this in Hamsterspeak, of course, and in CUSTOM. What do you think?

Top-posting FTW,
-->Seth





> 
> On Wed, Jan 14, 2009 at 09:38:35PM -0800, S'orlok
> Reaves wrote:
> > 
> > Given my limited knowledge of how the Standard OHR
> actually works, this still seems to handle things well. My
> main question is: what takes up slots 32 to 99999? I
> don't like the idea of excessive wasted space, unless
> it's unavoidable. 
> > 
> > -->Seth
> > 
> > 
> > --- On Wed, 1/14/09, James Paige
> <Bob at HamsterRepublic.com> wrote:
> > 
> > > From: James Paige <Bob at HamsterRepublic.com>
> > > Subject: [Ohrrpgce] thoughts about slice handles
> > > To: ohrrpgce at lists.motherhamster.org
> > > Date: Wednesday, January 14, 2009, 1:12 PM
> > > So I am thinking about slice handles.
> > > 
> > > As I have implemented them so far, slice handles
> are >0
> > > indexes into the 
> > > plotslices() array.
> > > 
> > > I was thinking about the conversion of floating
> plotstrings
> > > to string 
> > > slices. String handles are currently static
> numbers from
> > > 0-31
> > > 
> > > What if I make it so that slice handles start at
> some
> > > higher number like 
> > > say 100000. now, slice handle 100000 would
> actually be
> > > plotslices(0) and 
> > > 100001 would be plotslices(1)
> > > 
> > > So suppose you pass a static string handle of 31
> to
> > > "append ascii"
> > > 
> > > That slice handle would be pulled from a static
> unfreeable
> > > list of 
> > > string slice handles created when the program
> starts.
> > > 
> > > But if you pass 100004 which happens to be the
> return
> > > result of "new 
> > > string slice" as the handle for "append
> > > ascii", then it will know to 
> > > pull that string slice handle from plotslices(4).
> > > 
> > > Even though plotslices() and staticstringslices()
> would be
> > > separate 
> > > tables, they would still be populated with
> pointers to
> > > slices in the 
> > > same slice tree, so old static strings would be
> fully
> > > interchangeable 
> > > with other slices for string operation purposes.
> > > 
> > > That would NOT give you the ability to use old
> static
> > > string handles for 
> > > things like anchor & alignment changes or
> > > tree-heirachy-relocation, but 
> > > that would be okay.
> > > 
> > > The same approach could be used later also for
> other
> > > handles that get 
> > > converted into slices (for example, maybe custom
> menu
> > > handles).
> > > 
> > > This seems like the best approach to enable
> slices while
> > > maintaining 
> > > backwards compatability with existing code, and
> with the
> > > right wrapper 
> > > functions it would not be to rough to code.
> > > 
> > > Any thoughts?
> > > 
> > > ---
> > > James Paige
> > > _______________________________________________
> > > Ohrrpgce mailing list
> > > ohrrpgce at lists.motherhamster.org
> > >
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
> > 
> > 
> >       
> > _______________________________________________
> > Ohrrpgce mailing list
> > ohrrpgce at lists.motherhamster.org
> >
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
> > 
> >


      



More information about the Ohrrpgce mailing list