Riccardo GUIDA wrote: > > Hi, > > if this is not the correct place for sending FricasUG fix requirements, > please excuse me and let me now. > > RiCCardo > > [FricasUG] FIXME: sec 2.5.2 "Union-s with selectors" pag 96 > "Note that case uses the selector name as its right-hand argument. If you > accidentally use the branch > type on the right-hand side of case, false will be returned. Now it returns > error." > > > (1) -> U := Union(i:Integer, s:String) > > (1) Union(i: Integer,s: String) > Type: Type > (2) -> x:U := "bam" > > (2) "bam" > Type: Union(s: String,...) > (3) -> x case Integer > > >> Error detected within library code: > upcase: bad Union form > > (3) -> x case String > > >> Error detected within library code: > upcase: bad Union form > > (3) -> x case i > > (3) false > Type: Boolean > (4) -> x case s > > (4) true > > The statements above prove that the fricasUG must be fixed.
Yes, above using type gives an error. I need to check to determine if error will be always detected. Consider perverse things like Union(Integer : Float, Float : Integer) ATM you can create it but there are problem during use. But there are natural coding examples which can lead to similar things. More precisely, there are situations when we want to use the same identifier as union tag and as variable name. But variables may contain types. Natural solution is to treat identifier as tag name, ignoring possible meaning as a type. Of course, behaviour you see is different. > > === Feature suggestion for Union-s === > > I must say that I would find more natural (and maybe it would have simpler > code) > to have the predicates > x case Integer > x case String > as for non-selector Union-s That would be quite problematic. -- Waldek Hebisch -- 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 fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.