YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
26 stars 8 forks source link

Change how optional arguments are represented within the runtime #4376

Open rwkay opened 10 months ago

rwkay commented 10 months ago

Description

Currently we use -1 to denote that a function has a variable number of arguments at runtime, unfortunately this means that we cannot check that the number of arguments that are given meets the minimum requirements for a function that takes an optional number.

Instead we should use a negative number that is the minimum number required i.e. -1 would mean that it needs to have 1 or more arguments, -2 that it should have 2 or more etc. etc.

This would allow for better runtime checking.

Expected Change

No response

Steps To Reproduce

  1. Start GameMaker
  2. See the issue

How reliably can you recreate this issue using your steps above?

Always

Which version of GameMaker are you reporting this issue for?

2023.11.1 (Monthly)

Which platform(s) are you seeing the problem on?

Windows

Contact Us Package Attached?

Sample Project Added?

Alphish commented 10 months ago

Perhaps it could be tweaked so that -1 means "0 or more", -2 means "1 or more", -3 means "2 or more" etc.? If -1 means "1 or more" etc. then there's no way to differentiate between "exactly 0" and "0 or more", unless the datatype supports negative 0.

cameron-home commented 3 months ago

Is this still planned for August?