Re: Fallbacks in Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message
dcuny said...

These things aren't as simple as it initially looks.

if you alter the metadata for a sequence, you may just be modifying a local copy. The end result is that nothing changes.

On the other hand, using a global to hold the metadata has other potential issues - if the metadata applies to all the sequences, that means that modifying one particular sequence may potentially modify all of them.

So there's a lot of thinking that has to take place on this to even decide if it is practical.

A quick recap on how delete_routine() works may help.

  data = delete_routine(data,rid) 

So yes, (without pbr) it modifies a local copy but then overwrites the original anyway.

The natural instinct is to store a routine_id on the sequence. However delete_routines may be daisy-chained together, so instead (Phix) stores an index to a table of delete_routine collections. In Phix, builtins/pDelete.e contains sequence delete_sets which holds those sets entirely independently of the data, which only has an index attached to it. Naturally, builtins/pDelete.e does not clobber delete_sets[idx] as that may be in use on other data but instead crafts a new entry and replaces the index on the data.

It also strikes me that when associating multiple fallbacks to a value, rather than adding a new index for each have just the one index that refers to some fallback collection held elsewhere. In fact delete_routine could and probably should be demoted from it's current pole position to fallback_collections[idx][K_DELETE].

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu