Re: TIP #261: Return Imported Commands from [namespace import]



Hi Martin,

fine that you like my proposal.

Pondering your objections concerning usage of either implementation,
why not take it all? Just implement three options
-origin returns a list of original names,
-target returns a list of imported names,
-both (grrh, pleas find a better name) follows my suggestion.
One of them, the most frequently used, should be the default
when no option is given.

If this TIP is included in the core (I hope so) it will extend
the core size, of course. The few lines of extra code to implement
all the above options will certainly not make the core fat.

Good luck with your TIP.

Kind regards

Ulrich

Am Fri, 24 Feb 2006 01:53:50 -0800 schrieb MartinLemburg@UGS:

Hi Ulrich,

One thing I don't like is the -origin option. Wouldn't it
be easier to have 'namespace import' return a list of
imported name / original name pairs, or alternatively
a list of lists of such pairs?

A really nice idea!

I haven't thought of this yet.

My idea was to reduce the amount of work to have both the origin of an
exported and the exported command itself without the need to create a
new procedure.
And your suggestion matches this probably much better than the
"-origin" option.

But on the other side ... every thing that could be done in tcl and
does not need to be done in the core ... some people prefer to keep the
core as slim as possible!

So the example above in the TIP ...

proc namespace_import-origins {} {
set result {}
foreach cmd [uplevel 1 namespace import] {
lappend result [uplevel 1 [list namespace origin $cmd]]
}
return $result
}

... is for some developers the right way, instead of tweaking the core
to return the origins, too!

IHMO the core should make the work and the usage of tcl as easy as
possible. But I'm not sure, whether this or that solution really helps
in both cases to easy up the work and the usage!

Your suggestion to return both the exported command (origin) and the
imported command creates probably much more data (noise) than needed,
so that some developers may be forced to filter this data. (more work
and not easier to use)
Otherwise - some developers find what they want with a minimum of work!

My suggestion to use the option "-origin", was about to help developers
to get the imported commands or their origins, so to get both only two
calls would be needed.
There would be no need to filter the result, to filter out "noise"!
And there would be no need to create an extra procedure to collect all
the origins of the exported commands.

Ok - there could be a wiki page with a contest of the best and fastest
origns collector procedure and this could be really fun, but why must
developers create such basic functionality, if it is so easy to
implement into the core?

There other areas, discussed here in the newsgroup during the last
weeks, where the discussion was (in my eyes) about to implement basic
functionality into the core, where some people like this, and some
people said, that everybody can do his own solution, that the core has
to be slim!

But ... I was never a friend of reinventing the wheel!

I hope this will be discussed intensively!

Best regards,

Martin Lemburg
UGS - Transforming the Process of Innovation

.



Relevant Pages

  • Re: TIP #261: Return Imported Commands from [namespace import]
    ... does not need to be done in the core ... ... Your suggestion to return both the exported command and the ... so that some developers may be forced to filter this data. ... to get the imported commands or their origins, so to get both only two ...
    (comp.lang.tcl)
  • Re: [PATCH/RFC] SPI core: turn transfers to be linked list
    ... the patch attached changes the way transfers are chained in the SPI core. ... they are turned into linked lists instead of array. ... The array may be of any size thus we can't divide the page into regions of the same size: we can't predict what the maximum size will be. ... technique for both message structure and transfer structure The problem with the current code is that transfers are represnted as an array so it can be of any size effectively. ...
    (Linux-Kernel)
  • Article: On the Origins of Chemical Biodefense
    ... On the Origins of Chemical Biodefense ... The system has survived in vertebrates with its core components ... The protein C3, a member of a small family of ... eight copies of a simple three-dimensional motif, ...
    (sci.bio.evolution)
  • RE: PLEASE HELP! creating fields on a form that autopopulate
    ... I now have the F_PurchaseOrder that lists my main purchase order info: ... My subform lists all the detail info of my purchase order: ... Core Return required, and warranty info. ...
    (microsoft.public.access.forms)
  • Sun specific header files
    ... I had a C program that uses variable argument lists that worked fine on ... but core dumped on the Sun. ... core dumping again, same place, same problem but this time the include ...
    (comp.unix.solaris)