GulfOfMexico icon indicating copy to clipboard operation
GulfOfMexico copied to clipboard

Order of Exclamation Marks

Open ktlknss opened this issue 2 years ago • 7 comments

Code should be ran in the order of least exclamation marks to most exclamation marks (matching Overloading) ex:

print(hello_world)! // hello world
const const hello_world = "hello world"!!

the second line will be ran first because it has more exclamation marks

ktlknss avatar Jul 09 '23 16:07 ktlknss

print(hello_world)??
const const const hello_world = "hi"?

The second line should be ran first because the author is less unsure about the second line compared to the first one (fewer question marks).

r0hin avatar Jul 15 '23 23:07 r0hin

How would this work with reverse? Would reverse go backwards in the determined execution order?

jessiejs avatar Jul 16 '23 03:07 jessiejs

The second line should be ran first because the author is less unsure about the second line compared to the first one (less question marks).

and anything with ! should be ran before ? because the user is more sure CODE:

print("World")?
print("Hello")!

OUTPUT (without debug)

Hello
World

ktlknss avatar Jul 16 '23 15:07 ktlknss

How would this work with reverse? Would reverse go backwards in the determined execution order?

The way I would imagine it happening is the "compiler" would rearrange the code USER TYPED:

print("World")!
print("Hello")!!

COMPILER REARRANGED:

print("Hello")!
print("World")!

OUTPUT:

Hello
World

so reverse would reverse the order of the rearranged code

ktlknss avatar Jul 16 '23 15:07 ktlknss

so reverse would reverse the order of the rearranged code

ah, so reverse happens after the Determined Exclamation Execution reZolution (No Use of TypeScript) step.

jessiejs avatar Jul 16 '23 16:07 jessiejs

and anything with ! should be ran before ? because the user is more sure

Similar to that, this would be the order:

!!!! // Run first
!!!
!!
!
?
??
???
???? // Run Last

ktlknss avatar Jul 30 '23 06:07 ktlknss

Also from Overloading we will be also using upside down question and exclamation marks with the order. :)

ktlknss avatar Nov 15 '23 18:11 ktlknss