Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

OCaml Language hen a pattern of a record is created, is it a requirement that al

ID: 3733150 • Letter: O

Question

OCaml Language hen a pattern of a record is created, is it a requirement that all of the fields in the pattern be used? If you want the compiler to give you a warning when there are extra fields in a record that the pattern is not using, what needs to be included? 5. When the compiler warnings are turned on, and the pattern you have created does not have all of the fields in the record, and for this particular pattern you don't want to see the warnings when you compile, what can you do to indicate to the compiler that you don't want to see the warning for this pattern? 5 Of 6

Explanation / Answer

yes is it requiremebt that all of the fields in the pattern be used for checking because when a pattern is matched in a record then it performs action. fields are the variables in the current record which share the properties of simple variables.

if we want the complier to give you a warning when there are extra fields in a record that patterns is not using than undescore should be included. this is an good idea that to enable a warning when a record not matches and disable it with an _ where necessary.

when the compiler warnings are turned on and pattens are created doesnot have all the fields in the pattern and for this particular pattern you dont want to see the warning when you compile then warnings are treated as errors and also parsing is used with these errors.