unofficial mirror of gwl-devel@gnu.org
 help / color / mirror / Atom feed
* Support for guile-config 0.5
@ 2022-05-25  3:31 Taiju HIGASHI
  2022-06-01 13:01 ` Ricardo Wurmus
  2022-07-06  8:36 ` Ricardo Wurmus
  0 siblings, 2 replies; 9+ messages in thread
From: Taiju HIGASHI @ 2022-05-25  3:31 UTC (permalink / raw)
  To: gwl-devel

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

Hi,

I am currently working on the following issue.
https://issues.guix.gnu.org/55612

I have understood that I need to modify gwl to get guile-config 0.5.0
into Guix. However, I know almost nothing about gwl. Is it possible to
get some advice?

It seems that the following commits have incompatible specification
changes.
https://gitlab.com/a-sassmannshausen/guile-config/-/commit/8a107639e8b0f1037518a36fab56dde051b028d8
https://gitlab.com/a-sassmannshausen/guile-config/-/commit/3bf3adde491df551a357a3ac05d137652e825fbe

The `optional` in the configuration specification has been removed and
`argument` and `switch` are now interpreted as mandatory when `default`
is `empty`.

I have created the attached patch based on this fact. The gwl build now
passes.  Is there any other work that needs to be done? I am unsure as I
do not know much about gwl.

Thanks,

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-config-Support-for-new-optional-mandatory-semantics.patch --]
[-- Type: text/x-patch, Size: 1557 bytes --]

From 8caf849c1ed20ba0f80d766acc1854ef53a48d6f Mon Sep 17 00:00:00 2001
From: Taiju HIGASHI <higashi@taiju.info>
Date: Wed, 25 May 2022 00:05:46 +0900
Subject: [PATCH] config: Support for new optional/mandatory semantics.

Because there has been a specification change in the way option
arguments and mandatory switches are specified since guile-config 0.5.
---
 gwl/config.scm.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gwl/config.scm.in b/gwl/config.scm.in
index 9ab58e5..f789998 100644
--- a/gwl/config.scm.in
+++ b/gwl/config.scm.in
@@ -65,7 +65,6 @@ workflow.")
        (list
         (argument
          (name 'file)
-         (optional? #false)
          (test file-exists?)
          (handler identity)
          (example "/path/to/my-workflow.w"))))
@@ -95,12 +94,14 @@ workflow.")
          (character #\i)
          (synopsis "Specify workflow input NAME, optionally mapped to FILE")
          (example "NAME[=FILE]")
+         (default "")
          (test string?))
         (switch
          (name 'output)
          (character #\o)
          (synopsis "Set LOCATION as output for a workflow")
-         (example "LOCATION"))
+         (example "LOCATION")
+         (default ""))
         (switch
          (name 'engine)
          (character #\e)
@@ -147,7 +148,6 @@ format) of the specified workflow.")
        (list
         (argument
          (name 'file)
-         (optional? #false)
          (test file-exists?)
          (handler identity)
          (example "/path/to/my-workflow.w")))))
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-05-25  3:31 Support for guile-config 0.5 Taiju HIGASHI
@ 2022-06-01 13:01 ` Ricardo Wurmus
  2022-06-01 14:28   ` Taiju HIGASHI
  2022-07-06  8:36 ` Ricardo Wurmus
  1 sibling, 1 reply; 9+ messages in thread
From: Ricardo Wurmus @ 2022-06-01 13:01 UTC (permalink / raw)
  To: Taiju HIGASHI; +Cc: gwl-devel


Hi,

thank you for the patch.

> The `optional` in the configuration specification has been removed and
> `argument` and `switch` are now interpreted as mandatory when `default`
> is `empty`.

The patch looks wrong to me, but maybe I’m just misunderstanding things.

> diff --git a/gwl/config.scm.in b/gwl/config.scm.in
> index 9ab58e5..f789998 100644
> --- a/gwl/config.scm.in
> +++ b/gwl/config.scm.in
> @@ -65,7 +65,6 @@ workflow.")
>         (list
>          (argument
>           (name 'file)
> -         (optional? #false)
>           (test file-exists?)
>           (handler identity)
>           (example "/path/to/my-workflow.w"))))
> @@ -95,12 +94,14 @@ workflow.")
>           (character #\i)
>           (synopsis "Specify workflow input NAME, optionally mapped to FILE")
>           (example "NAME[=FILE]")
> +         (default "")
>           (test string?))

Okay.

>          (switch
>           (name 'output)
>           (character #\o)
>           (synopsis "Set LOCATION as output for a workflow")
> -         (example "LOCATION"))
> +         (example "LOCATION")
> +         (default ""))

This makes the “output” switch mandatory, but it’s optional.

>          (switch
>           (name 'engine)
>           (character #\e)
> @@ -147,7 +148,6 @@ format) of the specified workflow.")
>         (list
>          (argument
>           (name 'file)
> -         (optional? #false)
>           (test file-exists?)
>           (handler identity)
>           (example "/path/to/my-workflow.w")))))

And this just makes the file argument optional, but it’s not.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-06-01 13:01 ` Ricardo Wurmus
@ 2022-06-01 14:28   ` Taiju HIGASHI
  2022-06-01 20:29     ` Ricardo Wurmus
  0 siblings, 1 reply; 9+ messages in thread
From: Taiju HIGASHI @ 2022-06-01 14:28 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: gwl-devel

Hi Ricardo,

Thank you for reviewing.

I'm not confident in them, but I will tell you my thought.

>>          (switch
>>           (name 'output)
>>           (character #\o)
>>           (synopsis "Set LOCATION as output for a workflow")
>> -         (example "LOCATION"))
>> +         (example "LOCATION")
>> +         (default ""))
>
> This makes the “output” switch mandatory, but it’s optional.

The (default (empty)) and the (default "") are different things.
The (default (empty)) is the default value of the switch record default field.
If I don't add that line, that switch will make evaluated as mandatory
because the default field is (empty). [1]

>>          (switch
>>           (name 'engine)
>>           (character #\e)
>> @@ -147,7 +148,6 @@ format) of the specified workflow.")
>>         (list
>>          (argument
>>           (name 'file)
>> -         (optional? #false)
>>           (test file-exists?)
>>           (handler identity)
>>           (example "/path/to/my-workflow.w")))))
>
> And this just makes the file argument optional, but it’s not.

It is not to change the meaning.
The optional field of the argument record has been removed, so if I do
not delete it, thus it will cause an error.

Since the default value of the default field of the argument record is
(empty),  If I want to mandatory an argument record, In case I just
delete the (optional? #f) line. [2]

Sorry if I am wrong.

[1]:
https://gitlab.com/a-sassmannshausen/guile-config/-/blob/6a00702d044663fef6d6d619f4aeb75417e1b10b/config/api.scm#L167
[2]:
https://gitlab.com/a-sassmannshausen/guile-config/-/commit/9c1b1627dee927839049168a1dfc2500955c83a6#7643f2674b06b682eb8c0695dfc8e1c252099b2f

Cheers,
--
taiju


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-06-01 14:28   ` Taiju HIGASHI
@ 2022-06-01 20:29     ` Ricardo Wurmus
  2022-06-02  0:52       ` Taiju HIGASHI
  0 siblings, 1 reply; 9+ messages in thread
From: Ricardo Wurmus @ 2022-06-01 20:29 UTC (permalink / raw)
  To: Taiju HIGASHI; +Cc: gwl-devel

Hi again,

Taiju HIGASHI <higashi@taiju.info> writes:

> I'm not confident in them, but I will tell you my thought.
>
>>>          (switch
>>>           (name 'output)
>>>           (character #\o)
>>>           (synopsis "Set LOCATION as output for a workflow")
>>> -         (example "LOCATION"))
>>> +         (example "LOCATION")
>>> +         (default ""))
>>
>> This makes the “output” switch mandatory, but it’s optional.
>
> The (default (empty)) and the (default "") are different things.
> The (default (empty)) is the default value of the switch record default field.
> If I don't add that line, that switch will make evaluated as mandatory
> because the default field is (empty). [1]

Yes, you are right, sorry.

>>>          (switch
>>>           (name 'engine)
>>>           (character #\e)
>>> @@ -147,7 +148,6 @@ format) of the specified workflow.")
>>>         (list
>>>          (argument
>>>           (name 'file)
>>> -         (optional? #false)
>>>           (test file-exists?)
>>>           (handler identity)
>>>           (example "/path/to/my-workflow.w")))))
>>
>> And this just makes the file argument optional, but it’s not.
>
> It is not to change the meaning.
> The optional field of the argument record has been removed, so if I do
> not delete it, thus it will cause an error.

You are right.  Sorry, I got confused :)

> Since the default value of the default field of the argument record is
> (empty),  If I want to mandatory an argument record, In case I just
> delete the (optional? #f) line. [2]


So I guess the only thing I need to check is what to do when the default
value is the empty string.  We have some options that have validators.
When the value is the empty string and the validator merely checks that
the value is a string, then we would always pass validation in the
default case.

I’ll play with this some more and try to come up with better input
validation.

Thanks for getting the ball rolling with this patch!

-- 
Ricardo


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-06-01 20:29     ` Ricardo Wurmus
@ 2022-06-02  0:52       ` Taiju HIGASHI
  2022-06-06 11:23         ` Ricardo Wurmus
  0 siblings, 1 reply; 9+ messages in thread
From: Taiju HIGASHI @ 2022-06-02  0:52 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: gwl-devel

Hi Ricardo,

> I’ll play with this some more and try to come up with better input
> validation.

Thank you!

By the way, GWL is a very interesting tool for me.

I had never seen such effective use of Wisp (or variants of
M-expression) as GWL.
I thought it was an attractive feature when using Wisp as a DSL.

I often write CI and other automated scripts, so I would love to try it
if I get the chance!

Cheers,
--
taiju


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-06-02  0:52       ` Taiju HIGASHI
@ 2022-06-06 11:23         ` Ricardo Wurmus
  2022-06-06 15:25           ` Taiju HIGASHI
  0 siblings, 1 reply; 9+ messages in thread
From: Ricardo Wurmus @ 2022-06-06 11:23 UTC (permalink / raw)
  To: Taiju HIGASHI; +Cc: gwl-devel


Taiju HIGASHI <higashi@taiju.info> writes:

> I had never seen such effective use of Wisp (or variants of
> M-expression) as GWL.
> I thought it was an attractive feature when using Wisp as a DSL.

That’s very kind of you.  I have spent a lot of time trying to make the
DSL seem unsurprising.  Wisp made this easier than it otherwise would
have been.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-06-06 11:23         ` Ricardo Wurmus
@ 2022-06-06 15:25           ` Taiju HIGASHI
  0 siblings, 0 replies; 9+ messages in thread
From: Taiju HIGASHI @ 2022-06-06 15:25 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: gwl-devel

>> I had never seen such effective use of Wisp (or variants of
>> M-expression) as GWL.
>> I thought it was an attractive feature when using Wisp as a DSL.
>
> That’s very kind of you.  I have spent a lot of time trying to make the
> DSL seem unsurprising.  Wisp made this easier than it otherwise would
> have been.

I hope that GWL will become more successful and that in the future there
will be many people who say, "Oh, yes, there was a time when workflows
were defined in YAML, which was ridiculous!" :)

-- 
Taiju


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-05-25  3:31 Support for guile-config 0.5 Taiju HIGASHI
  2022-06-01 13:01 ` Ricardo Wurmus
@ 2022-07-06  8:36 ` Ricardo Wurmus
  2022-07-06  9:54   ` Taiju HIGASHI
  1 sibling, 1 reply; 9+ messages in thread
From: Ricardo Wurmus @ 2022-07-06  8:36 UTC (permalink / raw)
  To: Taiju HIGASHI; +Cc: gwl-devel


Taiju HIGASHI <higashi@taiju.info> writes:

> I am currently working on the following issue.
> https://issues.guix.gnu.org/55612

This commit makes the GWL ready for guile-config 0.5.x:

https://git.savannah.gnu.org/cgit/gwl.git/commit/?id=c0f281d2ef927686ed42f9c44828c501011a60dc

We don’t have a new release yet, but I don’t want your upgrade of
guile-hall to be blocked any longer.

Thanks for notifying me!

-- 
Ricardo


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Support for guile-config 0.5
  2022-07-06  8:36 ` Ricardo Wurmus
@ 2022-07-06  9:54   ` Taiju HIGASHI
  0 siblings, 0 replies; 9+ messages in thread
From: Taiju HIGASHI @ 2022-07-06  9:54 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: gwl-devel

>> I am currently working on the following issue.
>> https://issues.guix.gnu.org/55612
>
> This commit makes the GWL ready for guile-config 0.5.x:
>
> https://git.savannah.gnu.org/cgit/gwl.git/commit/?id=c0f281d2ef927686ed42f9c44828c501011a60dc
>
> We don’t have a new release yet, but I don’t want your upgrade of
> guile-hall to be blocked any longer.
>
> Thanks for notifying me!

Thank you for your commit!

So far I am not having trouble, but if I apply this patch to v0.4.0,
would it be possible to increase the guile-hall version of Guix?
If other changes are needed, I am willing to wait for a new release of
GWL.

Regards,
-- 
Taiju


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-06 10:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25  3:31 Support for guile-config 0.5 Taiju HIGASHI
2022-06-01 13:01 ` Ricardo Wurmus
2022-06-01 14:28   ` Taiju HIGASHI
2022-06-01 20:29     ` Ricardo Wurmus
2022-06-02  0:52       ` Taiju HIGASHI
2022-06-06 11:23         ` Ricardo Wurmus
2022-06-06 15:25           ` Taiju HIGASHI
2022-07-06  8:36 ` Ricardo Wurmus
2022-07-06  9:54   ` Taiju HIGASHI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).