dMZX Forums: Ternary Operator -> Archived Requests -> Tracker

Jump to content

Report ID 450 Title Ternary Operator
Product Archived Requests Status Implemented (Severity 1 - Low)
Version 2.90 Fixed in GIT

Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Report ID #450: Ternary Operator

#1 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 22 May 2012 - 08:28 AM

Originally suggested by: NovaYoshi. I somewhat agree though, because I find myself making a lot of faux-ternary-operator constructs.

set "LOCAL" "('broseph'>0 ? 'beez'*('hello'?2:1) : 99)"


Basically, if the current value when the ? operator is reached is equal to 0, the expression discards everything up to the last : in the current focus. Otherwise, it discards everything between the ? and the next ? or : in the current focus, to prevent things from breaking when someone uses the thing improperly. If there's no : or nothing on the other side of :, it returns 0. If there's nothing between ? and :, it returns the result of the condition or 0 depending on what's favored.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository


Page 1 of 1  
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Replies (1 - 7)

#2 User is offline  
asiekierka 

  • ??
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,267
  • Joined: 06-April 06
  • Gender:Male
  • Location:Poland

Posted 11 June 2012 - 10:31 AM

I approve.
Huh.

#3 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 02 December 2012 - 03:49 AM

Updating status to: Awaiting Feedback

would like feedback
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#4 User is offline  
ajs 

  • carpe diem
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,614
  • Joined: 21-October 00
  • Gender:Male
  • Location:United Kingdom

Posted 23 December 2012 - 07:48 AM

I approve assuming you plan to implement it in both the regular and debytecode expression parser paths.

Quote

If there's nothing between ? and :, it returns the result of the condition or 0 depending on what's favored.

I personally would vote not to follow C here and assume invalid (0) if both sides of the : aren't provided. In C if you do a = b ? b : c; the 'b' might be evaluated twice if it is an expression itself. However, in C, with the a = b ?: c; form, b is evaluated only once.

--ajs.

#5 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 25 December 2012 - 03:02 AM

Updating status to: Approved
Updating severity to: 1 - Low
Updating version to: 2.85

Yes, I intend to implement this for both regular and debytecode. I'll wait for 2.85 to implement it, but I don't think a version check is necessary in this case.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#6 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 28 May 2017 - 05:58 AM

Updating status to: Implemented
Issue fixed in: GIT

Implemented in GIT a0b1faa for both regular and debytecode MZX.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#7 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 28 May 2017 - 08:16 AM

Fixed a bug where this broke c?? and p?? in debytecode in GIT 85b8add.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#8 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 29 June 2017 - 06:57 AM

Moving to: Archived Requests


Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

0 User(s) are reading this issue
0 Guests and 0 Anonymous Users


Powered by IP.Tracker 1.3.2 © 2025  IPS, Inc.