Quantcast

xs:anyURI in 'sm:chmod($path as xs:anyURI, $mode as xs:string)'?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

xs:anyURI in 'sm:chmod($path as xs:anyURI, $mode as xs:string)'?

Tony Graham
I have stumbled multiple times over having to supply an xs:anyURI to
change the mode of a collection that I've just created by supplying
strings.

The signature for sm:chmod() [1][3] is:

    sm:chmod($path as xs:anyURI, $mode as xs:string) as empty()

The signature for xmldb:create-collection() [4] is:

    xmldb:create-collection($target-collection-uri as xs:string,
$new-collection as
xs:string) as xs:string?

Is there any prospect of changing sm:chmod() to accept $path as
xs:string? After all, xs:anyURI can be promoted to xs:string [5], so
existing code would still work.

Regards,


Tony Graham.
--
Senior Architect
XML Division
Antenna House, Inc.
----
Skerries, Ireland
[hidden email]


[1]
http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/securitymanager&location=java:org.exist.xquery.functions.securitymanager.SecurityManagerModule&details=true
[2]
http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/xmldb&location=java:org.exist.xquery.functions.xmldb.XMLDBModule&details=true
[3] Incidentally, the signature for the deprecated
     xmldb:chmod-collection() [2] that I've never used is:

    xmldb:chmod-collection($collection as xs:string, $mode as
xs:integer) as item()

[4]
http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/xmldb&location=java:org.exist.xquery.functions.xmldb.XMLDBModule&details=true
[5] https://www.w3.org/TR/xquery-31/#promotion

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: xs:anyURI in 'sm:chmod($path as xs:anyURI, $mode as xs:string)'?

Adam Retter
On 30 March 2017 at 07:19, Tony Graham <[hidden email]> wrote:

> I have stumbled multiple times over having to supply an xs:anyURI to
> change the mode of a collection that I've just created by supplying
> strings.
>
> The signature for sm:chmod() [1][3] is:
>
>     sm:chmod($path as xs:anyURI, $mode as xs:string) as empty()
>
> The signature for xmldb:create-collection() [4] is:
>
>     xmldb:create-collection($target-collection-uri as xs:string,
> $new-collection as
> xs:string) as xs:string?


So I always hated it that the older functions in eXist that work with
URIs internally took xs:string as arguments. So when I created the sm
(SecurityManager) module, I made sure to use the correct types for the
function arguments. Unfortunately this does have the side effect that
you mentioned, i.e. you have to remember to use xs:anyURI.


> Is there any prospect of changing sm:chmod() to accept $path as
> xs:string? After all, xs:anyURI can be promoted to xs:string [5], so
> existing code would still work.

My feeling is that the design of the sm module is probably more
correct than the older xmldb module. However, I can appreciate it
might make things trickier.

So I guess the answer to the prospect of changing it is "maybe".
Personally I don't have much time or motivation to do that, but I
might be open to it if someone else wanted to do the change and it is
backwards compatible as you describe ;-)
However, I think we should really think about what is "correct" first.

--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...