[
https://issues.apache.org/jira/browse/SLING-8737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Radu Cotescu updated SLING-8737:
--------------------------------
Description:
The {{org.apache.sling.scripting.core}} module provides support for passing a
{{javax.script.Bindings}} to script engines, through the
{{org.apache.sling.scripting.core.impl.DefaultSlingScript}} implementation of
the {{org.apache.sling.api.scripting.SlingScript}} interface .
{{org.apache.sling.scripting.core.impl.DefaultSlingScript}} relies directly on
{{javax.script.SimpleBindings}}, which means that the values with which the map
is populated have to be computed before insertion. In some cases these
computations are not trivial, however there's no guarantee that the values will
actually be used.
In order to optimise the {{Bindings}} usage, given that Java 8 and above
provide the
[{{Supplier}}|https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html]
functional interface, both the {{org.apache.sling.api}} and
{{org.apache.sling.scripting.core}} modules should bring support for pushing
{{Suppliers}} into the {{Bindings}} maps, suppliers which would be invoked
on-demand.
was:
The {{org.apache.sling.scripting.core}} module provides support for passing a
{{javax.script.Bindings}} to script engines, through the
{{org.apache.sling.scripting.core.impl.DefaultSlingScript}} implementation of
the {{org.apache.sling.api.scripting.SlingScript}} interface .
{{org.apache.sling.scripting.core.impl.DefaultSlingScript}} relies directly on
{{javax.script.SimpleBindings}}, which means that the values with which the map
is populated have to be computed before insertion. In some cases these
computations are not trivial, however there's no guarantee that the values will
actually be used.
In order to optimise the {{Bindings}} usage, given that Java 8 and above
provide the
[{{Supplier}}|https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html]
functional interface, both the {{org.apache.sling.api}} and
{{org.apache.sling.scripting.core}} modules should bring support for pusing
{{Suppliers}} into the {{Bindings}} maps, suppliers which would be invoked
on-demand.
> Add support for lazily-evaluated bindings
> -----------------------------------------
>
> Key: SLING-8737
> URL: https://issues.apache.org/jira/browse/SLING-8737
> Project: Sling
> Issue Type: New Feature
> Components: Scripting
> Reporter: Radu Cotescu
> Assignee: Radu Cotescu
> Priority: Major
> Fix For: Scripting Core 2.1.0, API 2.21.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The {{org.apache.sling.scripting.core}} module provides support for passing a
> {{javax.script.Bindings}} to script engines, through the
> {{org.apache.sling.scripting.core.impl.DefaultSlingScript}} implementation of
> the {{org.apache.sling.api.scripting.SlingScript}} interface .
> {{org.apache.sling.scripting.core.impl.DefaultSlingScript}} relies directly
> on {{javax.script.SimpleBindings}}, which means that the values with which
> the map is populated have to be computed before insertion. In some cases
> these computations are not trivial, however there's no guarantee that the
> values will actually be used.
> In order to optimise the {{Bindings}} usage, given that Java 8 and above
> provide the
> [{{Supplier}}|https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html]
> functional interface, both the {{org.apache.sling.api}} and
> {{org.apache.sling.scripting.core}} modules should bring support for pushing
> {{Suppliers}} into the {{Bindings}} maps, suppliers which would be invoked
> on-demand.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)