On 27 September 2017 at 19:05, oldk1331 <[email protected]> wrote: > The point of 'wrap/unwrap' or something like that is to avoid to > specify type. Like you can use > > x := wrap y > > instead of > > x : Maybe A_VERY_LONG_TYPE := coerce y >
That is very much against the spirit of the SPAD language which was designed to support complete source and target polymorphism of operators. I do not think it is desirable to avoid specify types - even when they are long, e.g. use macros to abbreviate if you must. If I were to accept your argument this would imply that we should try to reduce this sort of polymorphism in many other existing uses of coerce/retract and in the case of other similar operators. > And you can use 'coerce' this way, but I prefer 'wrap', because > usually there are many 'coerce' for a type, but there's only one 'wrap'. > I do not like the idea that there is only one 'wrap'. > As for 'retract', because 'retractIfCan' should return a Maybe, > that makes Maybe more fundamental than RetractableTo. ?? RetractableTo is a category constructor, Maybe is a domain. Maybe is not more fundamental than RetractableTo. I do not see any problem that in the case of Maybe retractIfCan would become an identity. > And for the same reason, one can use 'unwrap' to avoid to > specify type. > > If you don't like the name of 'wrap/unwrap', there has to be > replacement other than 'coerce/retract', so what do you suggest? > (Like Haskell's 'just/fromJust'?) > I like the Axiom/FriCAS convention of using polymorphism to emphasize the generic algebraic properties of operators. So I do not like to replace coerce/retract with some other names in specific cases. And although they are not obviously dual, changing coerce/retract to some other pair of names throughout FriCAS does not seem desirable either. Bill. -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
