On Mon, 07 Jul 2014, Beno?t Minisini wrote:
> Le 07/07/2014 17:59, Tobias Boege a ?crit :
> >>
> >> Internally, you have to use an hash table anyway, haven't you? You just
> >> don't want to necessarily use string keys, as they are heavier than
> >> integer keys?
> >>
> >
> > Oh! My thoughts were: I'll need a translation table for vertex IDs into
> > internal indices (e.g. over an adjacency matrix) and to search for a
> > mapping, that table must be sorted, so I have to compare a lot. That alone
> > would actually be negligible overhead. And with a hash table, not even
> > this problem arises. Thanks for doubting me :-) No problem to use String
> > keys straight from the beginning.
> >
> >> Anyway, you must use a Collection-like interface to access the graph
> >> nodes (to be consistent with the other Gambas containers). You can use
> >> integer keys with no problems, as later you can switch to string keys
> >> and keep the backward-compatibility.
> >>
> >> You can have both too : I mean having a Gambas hash table to reference
> >> nodes by names, and a special hash table using integer keys. A void hash
> >> table does not take a lot of memory.
> >>
> >
> > How would I write the signature of _get() down in this case?
> >
> 
> For integer keys: _get(Index As Integer) As ...
> 
> For string keys: _get(Index As String) As ...
> 
> For both: _get(Index As Variant) As...
> -> That needs more work to check the index, and it is confusing, so 
> forget the "both" case!
> 

Have you read my feature request mail for function overloading in
Gambas 4? ;-)

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to