public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* "void-valued expression where value is needed"
@ 2022-09-20 21:02 Panicz Maciej Godek
  2022-09-20 21:41 ` Arvydas Silanskas
  0 siblings, 1 reply; 2+ messages in thread
From: Panicz Maciej Godek @ 2022-09-20 21:02 UTC (permalink / raw)
  To: kawa

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

Suppose that I have some code like

(define (f)::void
  (call-with-values
      (λ () #!void)
    (λ result
      (apply values result))))

When I compile it, Kawa issues the warning:

void-valued expression where value is needed

I wonder whether this warning is desired in such circumstances?

(It surely makes it difficult to write values-agnostic macros)

What is interesting is that the warning disappears if I replace #!void with
(values) [unless I declare the function's return type as ::void].

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

* Re: "void-valued expression where value is needed"
  2022-09-20 21:02 "void-valued expression where value is needed" Panicz Maciej Godek
@ 2022-09-20 21:41 ` Arvydas Silanskas
  0 siblings, 0 replies; 2+ messages in thread
From: Arvydas Silanskas @ 2022-09-20 21:41 UTC (permalink / raw)
  To: Panicz Maciej Godek; +Cc: kawa mailing list

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

I think this is a sensible warning. If I see #!void ending up somewhere
inside a value object like a list (`result` in your snippet), that
immediately alarms me that something is wrong. An empty `values` call is a
defined case, it would simply yield an empty `result` list.

2022-09-21, tr, 00:02 Panicz Maciej Godek via Kawa <kawa@sourceware.org>
rašė:

> Suppose that I have some code like
>
> (define (f)::void
>   (call-with-values
>       (λ () #!void)
>     (λ result
>       (apply values result))))
>
> When I compile it, Kawa issues the warning:
>
> void-valued expression where value is needed
>
> I wonder whether this warning is desired in such circumstances?
>
> (It surely makes it difficult to write values-agnostic macros)
>
> What is interesting is that the warning disappears if I replace #!void with
> (values) [unless I declare the function's return type as ::void].
>

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

end of thread, other threads:[~2022-09-20 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 21:02 "void-valued expression where value is needed" Panicz Maciej Godek
2022-09-20 21:41 ` Arvydas Silanskas

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).