> > That's why I suggested all those methods that take things like
> > integer arguments for HTL, etc., ought to be recoded to take nothing
> > but the message object, and get those values from the message's
> > FieldSet itself. That delays decoding to the very last moment, and
> > perhaps requires some extra encodes and decodes, but dozens of methods
> > suddenly lose lots of arguments, classes start looking alike so more
> > code sharing becomes available, the code is simpler to read, etc.
>
> And requires that each such method you call be transmitted the entire
> message. Thats ugly, because it duplicates transmission.
Most of those messages require a pointer to the message object anyway;
passing just that one pointer is more efficient that passing multiple
arguments. Methods that don't need the message are probably just
convience routines to do specific things (say, the HTL decrement method
and such), and those methods are where the extra conversions might
come in. I don't think there are many of those now, if any.
> > Even if we weakly type the fields, these methods should still be
> > fixed not to pass fields values explicity as arguments, but to look
> > them up from the message's FieldSet (which now has to have typed
> > getters and setters that would also be eliminated by just making
> > everything a string).
> Not a good idea, for above reason. You're also making the assumption that
> every method you're calling is as broad based as that.. How about this,
> for example:
>
> compareKey(long key)
> Under your model, it would be:
> compareKey(Message m).
No, it would be
compareKey(new Key(Message.getFieldSet().getField("SearchKey")))
where getField() returns a string (long is insufficient for keys).
If you wanted longs, change that to getFieldLongDecimal(), etc.
The assumption I make is that the code that wants to treat and
manipulate the "SearchKey" field as a specific type already knows
what type to expect, and so can call for it. By your method, I
might be able to do something like that for multiple fields of
a certain weak type, without knowing them explicitly. Comparison
is an operation that might make sense for.
--
Lee Daniel Crocker <lee at piclab.com> <http://www.piclab.com/lee/>
"All inventions or works of authorship original to me, herein and past,
are placed irrevocably in the public domain, and may be used or modified
for any purpose, without permission, attribution, or notification."--LDC
_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev