The only reason that I specified the parameter types in both the declaration
and definition is that they tend to be in different files, or different places
in the file, so it helps with readability to have a local indication of the
type. But I can always put it in a comment so its not an issue for me.

Readability is one issue where I agree with you.

The other thing is that it is actually guessing to match

      spnt(a,b) ==
        pt := new(n+1,0$DF)$Rep
        pt.0 := a
        pt.1 := b
        pt.n := 1...@df
        pt

with

    spnt:(a:DoubleFloat,b:DoubleFloat) -> %

Looking at the above code without knowing the types of a and b and also no return type, one would have to read the body in order to figure out the input and output types.

Seemingly pt will be of type Rep. Then since Rep is PrimitiveArray(DF), a and b must be of type DF, otherwise the code would not typecheck.
spnt returns pt, so the return type is Rep. Yes, it's Rep, not %.

That the compiler identifies Rep and % is an error in my eyes.

In fact, shouldn't it be possible in panAxiom to have

  spnt: (DF, DF) -> %

and

  spnt: (DF, DF) -> Rep

?

I am very much in favour of writing the types explicitly. It's easier for people who check the code.

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to