Option to limit type violation to only the type

This forum is for any questions about the language Tutorial D or the Rel implementation of it.
Post Reply
steved
Posts: 49
Joined: Sun Sep 01, 2013 10:53 pm

Option to limit type violation to only the type

Post by steved » Sat Apr 07, 2018 12:40 am

The following are two user defined type violations that can occur in an operator:

Code: Select all

ERROR: RS0037: Selector CHECK.FOR.MIXED.NUMERICAL.AND.NON.NUMERICAL.RANGES.WHICH.ARE.INVALID(BOOLEAN) violates POSSREP constraint in type 'FOR.IDS.MULTIPLIERS.AND.STRING.PART.NAMES..NUMERICAL.RANGES.WHERE.BEGINNING.AND.ENDING.TERMS.ARE.DIGITS.CANNOT.BE.MIXED.WITH.NON.NUMERICAL.RANGES.WHERE.THE.BEGINNING.AND.OR.ENDING.TERMS.DO.NOT.REPRESENT.DIGITS..ALL.RANGES.MUST.BE.ONE.OR.THE.OTHER'.

Line 1, column 9547 near '1'

In DECOMPOSE.STRINGS(CHARACTER) RETURNS RELATION {ID INTEGER, IDENT CHARACTER} line 1
In GENERATE.STRINGS(CHARACTER, CHARACTER, BOOLEAN, BOOLEAN, CHARACTER, CHARACTER, NUMBER.OF.CHARACTERS.PER.GROUP, BOOLEAN, BOOLEAN, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN, CHARACTER, BOOLEAN, BOOLEAN, CHARACTER, RELATION {LEVEL INTEGER, SDEL CHARACTER}) RETURNS RELATION {ID INTEGER, STR CHARACTER} line 1

Code: Select all

ERROR: RS0037: Selector CHECK.THAT.ALL.TERMS.ARE.DIGITS.WHEN.SPECIFYING.NUMERICAL.RANGES..NON.DIGIT.TERMS.IN.THIS.CASE.ARE.INVALID(BOOLEAN) violates POSSREP constraint in type 'FOR.IDS.MULTIPLIERS.AND.STRING.PART.NAMES..WHEN.USING.NUMERICAL.RANGES.ALL.OTHER.CSV.TERMS.MUST.ALSO.BE.NUMBERS.IE.DIGITS..USING.NUMERICAL.RANGES.LOCKS.YOU.IN.TO.SPECIFYING.JUST.DIGITS.FOR.ALL.TERMS..YOU.CAN.USE.A.PREFIX.TO.MODIFY.THE.RESULTING.DIGITS'.

Line 1, column 11182 near 'ATTR'

In DECOMPOSE.STRINGS(CHARACTER) RETURNS RELATION {ID INTEGER, IDENT CHARACTER} line 1
In GENERATE.STRINGS(CHARACTER, CHARACTER, BOOLEAN, BOOLEAN, CHARACTER, CHARACTER, NUMBER.OF.CHARACTERS.PER.GROUP, BOOLEAN, BOOLEAN, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN, CHARACTER, BOOLEAN, BOOLEAN, CHARACTER, RELATION {LEVEL INTEGER, SDEL CHARACTER}) RETURNS RELATION {ID INTEGER, STR CHARACTER} line 1
For anyone developing in Rel any and all information about a type violation or any error is most welcome.
That obviously includes where in the code the error occurred. But if the intent of the operator is an
example for users new to Rel, users who are unfamiliar with Rel operators and unfamiliar with the
inner workings of Rel then I think the information about where the type violation occurred is just
too much information. In this case I would argue that less is more. In this context, if it's feasible,
I would like Rel to have something like SET VerboseRelvarUpdates Off for type violations. IOW, I
think that all new users have to see is only the type in question which provides the necessary
information to re-run the operator successfully. I don't see the information about where in the code
the error was as particularly useful to those new to Rel. It may be just the opposite, leading
to unnecessary confusion.

thanks

Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: Option to limit type violation to only the type

Post by Dave » Sun Apr 08, 2018 4:12 pm

Interesting -- I'd never thought of these messages as being too much information. Rather, I'd sometimes thought they didn't provide enough information, as they provide just enough to be unambiguous. Any less detail, and there'd be some risk of ambiguity.

Unfortunately, unambiguous error messages are always a challenge for beginners -- something I know well from teaching C# as a first language to first-year Computer Science students. I think it's something that developers need to get used to in their journey from beginner to intermediate programmer.

Post Reply