MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

using Orestis Vantzos OOP package

  • To: mathgroup at
  • Subject: [mg76872] using Orestis Vantzos OOP package
  • From: Hannes Kessler <HannesKessler at>
  • Date: Tue, 29 May 2007 04:54:48 -0400 (EDT)


my question is related to difficulties to use Orestis Vantzos OOP
package ( in
other package files.

The following is from the OOP package
	MakeExpression[RowBox[{RowBox[{obj_, "::", msg_}], "[", args___,
"]"}], StandardForm] :=
		MakeExpression[RowBox[{obj, "[", RowBox[{"\"" <> msg <> "\"", "[",
args, "]"}], "]"}], StandardForm]

It gives the following interpretation rule for expressions typed in a
	obj::msg[args] -> obj["msg"[args]]
and allows you to write definitions similar to
	obj::msg[args] = 1

I saved the OOP package in a file OOP.m and loaded it with
The first problem was the following complaint by Mathematica
	SetDelayed::"write" :  "Tag MessageName in super::"path"[] is
resulting from the following line the OOP package
	super::path[] := $superPath;

The complaint disappears after changing changing this line to
	super["path"[]] := $superPath;
in agreement with the intended interpretation.

Loading the package and using it in a notebook works,
writing in class definitions expressions as for example
	volume[] := (4*Pi*self::radius[]^3)/3;

However, using class definitions in package files  causes problems.
Here is Vantzos Sphere-example written to TestSphere.m
	BeginPackage["TestSphere`", {"OOP`"}];
	volume[] := 4/3 Pi (self::radius[])^3;
	translateBy[\[CapitalDelta]x_] := (self::center[] += \

Loading the package to a notebook and using it leads to errors
	s1<=={"Sphere`", "Object`"};
	s1::radius[] = 1;
--> 4/3 Pi self::"radius"[]^3
instead of the expected 4/3 Pi
	s1::center[] = {1, 0, 0};
--> Error message
	AddTo::"rvalue" :  "self::"center"[] is not a variable with a value,
so its value cannot be changed."
instead of the expected {3,0,0}

I suspected the above MakeExpression interpretation rule for boxes
does not function in plain text package files.

But attempting
	MessageName[a_Symbol, b_String][args___] := a[b[args]]
does not help either as it generates the error
	Message::"name" :  "Message name a_Symbol::b_String is not of the
form symbol::name or symbol::name::language."

Any suggestions how to use the OOP package in other package files?

Thanks in advance.
Hannes Kessler

  • Prev by Date: Re: Quadratic form: symbolic transformation
  • Next by Date: Re: ideas needed!
  • Previous by thread: Re: Re: why won't style sheet appear in Stylesheet
  • Next by thread: Re: Polynomial to List