Re: The right context to declare a symbol
- To: mathgroup at smc.vnet.net
- Subject: [mg63060] Re: The right context to declare a symbol
- From: dh <dh at metrohm.ch>
- Date: Tue, 13 Dec 2005 03:40:41 -0500 (EST)
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
instead of simply declaring:
you could distinguish by "Head"
Trevor Baca wrote:
> I'm interested in creating two different "objects", which we'll call
> obj1 and obj2.
> So I create two separate .m packages callled obj1.m and obj2.m.
> Then let's say that for each object I want to define a getLength
> function (accessor) so that I can say both
> where p is an obj1 and q is an obj2.
> The problem is that if both obj1.m and obj2.m declare a getLength
> expression, then doing
> << obj1`
> works, but then adding
> << obj2`
> causes shadowing objections since, of course, the expression getLength
> now lives in two contexts.
> So what's the right way to declare a simple expression (like getLength,
> getName, getColor, etc) that operates on multiple different classes of
> object defined in different packages?
> It would, of course, work to declare getLength, etc, in, say, the
> System` or Global` context and NOT in any other context ... but that
> just seems odd. Shouldn't expressions related to a package live in the
Prev by Date:
Re: Re: How to hide a cell?
Next by Date:
Re: Turning on numerical computation
Previous by thread:
The right context to declare a symbol
Next by thread: