Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The special case for Filter assumes that DecodeParms are always present #62

Closed
bdoubrov opened this issue Apr 14, 2023 · 5 comments
Closed
Labels
invalid This doesn't seem right

Comments

@bdoubrov
Copy link
Collaborator

Currently Stream and other stream-based objects define the special case condition

fn:Eval(fn:ArrayLength(DecodeParms) == fn:ArrayLength(Filter))

for both Filter and DecodeParms keys. As a result, the following perfectly valid use case:

<<
/Filter [/FlateDecode]
% no DecodeParms
...
>>
stream
...
endstream

is reporting an error because of the special Filter condition.

There are two ways to fix this:

  1. either remove completely the special case for Filter
  2. or replace Filter special case condition by
fn:Eval(fn:IsPresent(DecodeParms,fn:ArrayLength(DecodeParms) == fn:ArrayLength(Filter)))

The same applies to FFilter and FDecodeParms keys.

@faceless2
Copy link
Collaborator

This caught me too the first time around. If DecodeParms is not present, then fn:ArrayLength(DecodeParms) doesn't evaluate to zero, it evaluates to undefined, which makes the whole expression undefined. See #30

@petervwyatt
Copy link
Member

As @faceless2 says...

@petervwyatt
Copy link
Member

petervwyatt commented Apr 17, 2023

See also #47 - just linking issues to keep track of related discussions

@bdoubrov
Copy link
Collaborator Author

bdoubrov commented Apr 20, 2023

Not sure if this is the best place to continue the discussion on the formal logic, or reopen #30. But as this issue is still open, I leave the comment here.

While the general use of undefined for missing properties is fine, I see some issues that the current Arlington boolean logic is not aligned with ECMAScript that also supports undefined. See https://tc39.es/ecma262/multipage/global-object.html#sec-undefined

The key difference is that the expression (a == undefined) is always false in JavaScript, while is undefined in Arlington.

Is there a fundamental problem in aligning Arlington boolean logic with ECMAScript one?

@petervwyatt
Copy link
Member

Yes - I'm trying to use predicate logic, NOT functional programming logic.

@bdoubrov bdoubrov added the invalid This doesn't seem right label Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants