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

regression with closures in maps (since 3.4.0) #1550

Closed
peterstadler opened this issue Sep 20, 2017 · 12 comments
Closed

regression with closures in maps (since 3.4.0) #1550

peterstadler opened this issue Sep 20, 2017 · 12 comments
Assignees
Labels
bug issue confirmed as bug high prio regression
Milestone

Comments

@peterstadler
Copy link
Contributor

What is the problem

Starting with eXist version 3.4.0 inline functions within maps will not inherit variables declared outside its function body. The problem has been discussed on eXist-open and was confirmed by @joewiz by testing against Saxon and BaseX.

What did you expect

I expected all three tests to pass without errors (as they do in eXist version 3.3.0).

Describe how to reproduce or add a test

xquery version "3.1";

module namespace ct="http://exist-db.org/xquery/closures/test";

declare variable $ct:model := function($param) {
    let $func := function() {
       $param
    }
    return
        map {
            'test1' : $func,
            'test2' : $func(),
            'test3' : function() {
                $param
            }
        }
};

declare %test:assertEquals('Hello World') function ct:test1-function-reference() as xs:string {
    try {
        $ct:model('Hello World')?test1()
    }
    catch * {$err:code || ' ' || $err:description}
};

declare %test:assertEquals('Hello World') function ct:test2-function-call() as xs:string {
    try {
        $ct:model('Hello World')?test2
    }
    catch * {$err:code || ' ' || $err:description}
};

declare %test:assertEquals('Hello World') function ct:test3-inline-function() as xs:string {
    try {
        $ct:model('Hello World')?test3()
    }
    catch * {$err:code || ' ' || $err:description}
};

Context information

  • eXist-db version 3.5.0-SNAPSHOT / fdaabad
  • Java 1.8.0_131 [Oracle Corporation]
  • Operating system MacOs Capitan 64 bit
  • vanilla build from develop branch
@wolfgangmm wolfgangmm self-assigned this Sep 20, 2017
@wolfgangmm wolfgangmm added this to the eXist-3.4.2 milestone Sep 20, 2017
@adamretter adamretter modified the milestones: eXist-3.4.2, eXist-3.5.0, eXist-3.6.0 Sep 25, 2017
@adamretter adamretter modified the milestones: eXist-3.6.0, eXist-3.5.1 Oct 21, 2017
@adamretter adamretter modified the milestones: eXist-3.5.1, eXist-3.6.1 Nov 27, 2017
@joewiz
Copy link
Member

joewiz commented Nov 29, 2017

Reviewing the details in this issue again, I notice the URL to the HoF article that Peter referenced in his exist-open post unfortunately isn’t working: http://atomic.exist-db.org/blogs/eXist/HoF...

HTTP ERROR 404

Problem accessing /exist/blogs/eXist/HoF. Reason:

Not Found

@peterstadler
Copy link
Contributor Author

The URL http://atomic.exist-db.org/blogs/eXist/HoF does work for me … maybe just a temporary server error?

@wolfgangmm
Copy link
Member

There were temporary hiccups with some pages on the server yesterday, which I fixed in the meantime.

It's best to point to http://exist-db.org/exist/apps/wiki/blogs/eXist/HoF though since http://atomic.exist-db.org is an old redirect.

@dizzzz dizzzz modified the milestones: eXist-3.6.1, eXist-3.7.0 Jan 4, 2018
@adamretter adamretter modified the milestones: eXist-3.7.0, eXist-4.0.1 Feb 14, 2018
@peterstadler
Copy link
Contributor Author

While I congratulate to the 4.0 release I tentatively want to remind you of this issue. It's something that keeps me from upgrading so I'm currently stuck with version 3.3.0.

Many thanks in advance!

@wolfgangmm
Copy link
Member

I had a look into this issue before 4.0 and I see where the problem is, but it's not straightforward to fix without potentially causing other regressions, so I did not want to risk it for the release.

@peterstadler
Copy link
Contributor Author

Thanks for the reply! I was just trying to make sure it wont be forgotten ;)

@dizzzz dizzzz added the bug issue confirmed as bug label Mar 5, 2018
@adamretter adamretter modified the milestones: eXist-4.0.1, 4.1.1 Apr 18, 2018
@adamretter adamretter modified the milestones: eXist-4.1.1, eXist-4.2.1 Jun 6, 2018
@adamretter adamretter modified the milestones: eXist-4.2.1, eXist-4.2.2 Jun 14, 2018
@adamretter adamretter modified the milestones: eXist-4.2.2, eXist-4.3.1 Jul 7, 2018
@peterstadler
Copy link
Contributor Author

Help! This is really an issue for me that prevents me from upgrading to a recent eXist version. Is a fix anywhere on the roadmap or do I have to refactor my code?

@wolfgangmm
Copy link
Member

Assigning high prio for myself.

@adamretter adamretter modified the milestones: eXist-4.3.1, eXist-4.3.2 Jul 24, 2018
@adamretter adamretter modified the milestones: eXist-4.3.2, eXist-4.4.1 Sep 21, 2018
@peterstadler
Copy link
Contributor Author

Sorry for bothering, but is there any chance this will be tackled in the near future?

@duncdrum
Copy link
Contributor

not directly related, but because namespace prefixes can appear in maps, the preferred and specs compliant map syntax is

return
        map {
            'test1': $func,
            'test2': $func(),
            'test3': function() {
                $param
            }
        }

only one ws after : in { key: value }

@adamretter
Copy link
Member

@peterstadler I think you will have to ask @wolfgangmm

@peterstadler
Copy link
Contributor Author

@duncdrum shall I create a PR for the tests?

wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 12, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 12, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 12, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 12, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 13, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 13, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 13, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 19, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Mar 19, 2019
…iables were not analyzed properly. This affects XQ

Suite tests, reporting wrong failures, but also eXist-db#1550.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug high prio regression
Projects
None yet
Development

No branches or pull requests

6 participants