Skip to content

CDM function's parameter type cardinality not being checked? #3422

Answered by SimonCockx
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ghost, I know this is an old question, but just to come back to this. There is actually a good reason why these cardinality checks are loose.

Just to illustrate, consider the following function that takes a required argument.

func RequiredArgumentFunction:
  inputs:
    required string (1..1)
  output:
    result boolean (1..1)

  set result:
    required = "Dummy"

As you have noted correctly, this function can also be called with an optional value, e.g., given an optional attribute

optional string (0..1)

we can still call RequiredArgumentFunction(optional) without any errors. Suppose that we would forbid this, then consider another expression:

if optional exists
then RequiredArgume…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lolabeis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #3012 on February 13, 2025 17:15.