Singular/Sources — pull request #137 by alexanderdreyer (2012-06-18 20:34:12+00:00)
Title: Enhancement: unary custom operations for newstruct

The patch adds the ability to override unary operations for newstruct'ed types, for instance:

```C
newstruct("myunion", "poly p,int i");
proc to_poly(myunion uni)
{
return (uni.p);
}

proc to_int(myunion uni)
{
return (uni.i);
}

ring r=0,x,dp;

myunion uni;
uni.p = x+1;
uni.i = 17;

system("install", "myunion", "poly", to_poly, 1);
system("install", "myunion", "int", to_int, 1);

poly(uni); // -> x+1
int(uni); // -> 17
```