Project

Profile

Help

Patch #1411

closed

user-defined closure() function

Added by Anonymous about 20 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Internals
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Legacy ID:
sf-1064863
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

SourceForge user: gschadow

Hi Michael,

this is the patch that implements user-defined closure()

functions. For clarity I have this decoupled from the

previous patch that contains the special-form / deferred

argument evaluation for extension functions. So, this

patch depends on the previous patch.

The attached ZIP file contains:

closure-only-for-saxon8.1.1.diff -- the patch

Functions.java -- a closure() extension function

demo/closure.xsl -- an example

demo/ClosureTestCounter.java -- a side-effect function

for the example

The demo is run simply on any input (e.g., on itself)

saxon8 closure.xsl closure.xsl

the point of the demo is to show how database inserts

and unique id generation would be deferred up until a

foreign key is required. In this example, a parent id is

only created if we actually insert a child that would refer

to the parent id. The output says what the id attributes

should be.

Implementing this required changes to ExpressionTool

eagerEvaluate and to Closure itself. Please look these

over, IMO they work fine. But this territory is a bit

obscure to me so I might be wrong. The problem with

your code seems to be that the closures are evaluated

when the argument is assigned to the variable or passed

as parameter, which is too early. It should be evaluated

only if the value is actually used. My patch seems to

accomplish this.

Please consider if you might adopt these few changes to

the core if at all possible. You don't need to actually

supply the closure() extension if you don't want to, but

the changes to ExpressionTool and Closure itself would

be highly appreciated.

Thanks,

-Gunther


Files

Actions #1

Updated by Anonymous about 20 years ago

SourceForge user: gschadow

Logged In: YES

user_id=575520

BTW: this is against saxon-8.1.1 of course.

Actions #2

Updated by Michael Kay over 11 years ago

  • Status changed from New to Closed

Closed because this hasn't been carried forward to newer Saxon releases, and there are better ways of meeting the requirement using higher order functions.

Please register to edit this issue

Also available in: Atom PDF