• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Bitwise operators | and & precedence

Community Beginner ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

I still can't believe this is possible. After few days (and nights) of debugging, I found that JSX doesn't confirms with JS specifications about '&' and  '|' operators precedence. 

In ESTK "1 | 1 & 0" results in 0. It should be the same as "1 | (1 & 0)", which is 1.

The issue I had was with an external minified library crypto-js and the debugging was real pain.

As I could't find this fact documented, I'm still wondering is that by design or it's Adobe's implementation bug?

TOPICS
Scripting

Views

853

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 09, 2018 May 09, 2018

Hi,

As per this thread it is stated that the scripting engine doesn't conform in all ways, so it could be either a bug or a implementation issue, Does Adobe have any plans to update JavaScript .

At the moment, I guess it is just best to be explicit with your JavaScript.

Regards

Malcolm

Votes

Translate

Translate
Community Expert ,
May 09, 2018 May 09, 2018

Copy link to clipboard

Copied

Hi,

As per this thread it is stated that the scripting engine doesn't conform in all ways, so it could be either a bug or a implementation issue, Does Adobe have any plans to update JavaScript .

At the moment, I guess it is just best to be explicit with your JavaScript.

Regards

Malcolm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 09, 2018 May 09, 2018

Copy link to clipboard

Copied

It sounds very much like the should be some major changes. I would expect some announcement within the next month or 2 but it might well be covered by an NDA.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 09, 2018 May 09, 2018

Copy link to clipboard

Copied

Hi, Malcolm,

Thanks for your replay. I have read the whole thread you mentioned, but there is no a single word about that issue.

I feel a bit more clarification is needed. Operators precedence is obviously considered too basic topic, to be covered in any InDesign Scripting Guide which I could find. In fact, the only place I found something on that subject is this After Effects CS6 Scripting Guide, which explicitly states on page 11, that '&' is with higher precedence than '|' operator. In fact, math operators are doing as expected, but logical operators have the same issue.

For me, there are two major lines:

1. This is not a bug but it's by jsx design. In that case no action from Adobe developers is needed, just to be explicitly pointed in the references and tutorials. AFAIK, any programming or scripting language conforms with the known mathematical, logical and bitwise order of operations. So this would be of a great difference.

2. It's a specific Adobe implementation bug. It must be addressed to Adobe team for resolution.

In both cases, i'd wish I knew that. Maybe not a big deal, but in my case the main problem is with the minified js libraries, where unnecessary (according to js specs) parentheses are removed. And there is no easy solution.

Regards

Anton

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 10, 2018 May 10, 2018

Copy link to clipboard

Copied

LATEST

Marked as correct

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2018 May 10, 2018

Copy link to clipboard

Copied

Hi,

I posted the thread so you could see 2 points, 1 - that ExtendScript does not conform to the specifications, and hence you get some anomalies in how code functions. and 2 - that there is a debate about what to do with Scripting going forward, do Adobe update extendscript or move to a different framework (nodejs ........ ).

This was just to give you some understanding of where the ExtendScript library is, and the problems that can arise because of this.

I agree that it should be fixed/updated to match the specification but until such time as there is a approach chosen by Adobe as to how to move forward with ExtendScript, we pretty much have to work around the issues.

As always you can log the issue officially with Adobe here - Feature Request/Bug Report Form

Regards

Malcolm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines