unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* SCM_ASSERT_TYPE
@ 2003-07-02 16:16 Han-Wen Nienhuys
  2003-07-02 22:48 ` SCM_ASSERT_TYPE Kevin Ryde
  0 siblings, 1 reply; 10+ messages in thread
From: Han-Wen Nienhuys @ 2003-07-02 16:16 UTC (permalink / raw)



The expansion of SCM_ASSERT_TYPE includes an if statement, which will
lead to unexpected effects for code like

     if (optional != SCM_UNDEFINED)
	SCM_ASSERT_TYPE(optional, ... );
     else
        optional = default_value;

I've fixed this by adding else to the macro, i.e.

	#define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg) \
		if (!(_cond)) \
		  scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg); else

are there any other macros in GUILE that expand to if statements?



-- 

Han-Wen Nienhuys   |   hanwen@cs.uu.nl   |   http://www.xs4all.nl/~hanwen 


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: SCM_ASSERT_TYPE
  2003-07-02 16:16 SCM_ASSERT_TYPE Han-Wen Nienhuys
@ 2003-07-02 22:48 ` Kevin Ryde
  2003-07-02 23:01   ` SCM_ASSERT_TYPE Han-Wen Nienhuys
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Ryde @ 2003-07-02 22:48 UTC (permalink / raw)
  Cc: guile-devel

Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
>
> I've fixed this by adding else to the macro, i.e.

The usual style is "do { ... } while (0)", which has the advantage of
giving an error if one forgets the terminating ";" when using it.  See
SCM_ASYNC_TICK for instance.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: SCM_ASSERT_TYPE
  2003-07-02 22:48 ` SCM_ASSERT_TYPE Kevin Ryde
@ 2003-07-02 23:01   ` Han-Wen Nienhuys
  0 siblings, 0 replies; 10+ messages in thread
From: Han-Wen Nienhuys @ 2003-07-02 23:01 UTC (permalink / raw)
  Cc: guile-devel

user42@zip.com.au writes:
> Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> >
> > I've fixed this by adding else to the macro, i.e.
> 
> The usual style is "do { ... } while (0)", which has the advantage of
> giving an error if one forgets the terminating ";" when using it.  See
> SCM_ASYNC_TICK for instance.

Yes, you're right. Changed it.

-- 

Han-Wen Nienhuys   |   hanwen@cs.uu.nl   |   http://www.xs4all.nl/~hanwen 


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* SCM_ASSERT_TYPE
@ 2011-10-07 13:00 Mike Gran
  2011-10-08 22:04 ` SCM_ASSERT_TYPE Ludovic Courtès
  2012-01-05 16:33 ` SCM_ASSERT_TYPE Andy Wingo
  0 siblings, 2 replies; 10+ messages in thread
From: Mike Gran @ 2011-10-07 13:00 UTC (permalink / raw)
  To: guile-devel

Hello all-

Is the SCM_ASSERT_TYPE macro considered to be a stable public API
or internal to Guile?  It has never been mentioned in the manual,
but both Lilypond and GNU Serveez have used it.

And what about the seldom-used SCM_ASRTGO?


Thanks,

Mike




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

* Re: SCM_ASSERT_TYPE
  2011-10-07 13:00 SCM_ASSERT_TYPE Mike Gran
@ 2011-10-08 22:04 ` Ludovic Courtès
  2012-01-05 16:37   ` SCM_ASSERT_TYPE Andy Wingo
  2012-01-05 16:33 ` SCM_ASSERT_TYPE Andy Wingo
  1 sibling, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2011-10-08 22:04 UTC (permalink / raw)
  To: guile-devel

Hi,

Mike Gran <spk121@yahoo.com> skribis:

> Is the SCM_ASSERT_TYPE macro considered to be a stable public API
> or internal to Guile?  It has never been mentioned in the manual,
> but both Lilypond and GNU Serveez have used it.

Then I think it’s de-facto public and the fix should be to document it.
Would you like to do it?  :-)

> And what about the seldom-used SCM_ASRTGO?

Likewise (Google Codesearch finds a couple of external users.)

Thanks,
Ludo’.




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

* Re: SCM_ASSERT_TYPE
  2011-10-07 13:00 SCM_ASSERT_TYPE Mike Gran
  2011-10-08 22:04 ` SCM_ASSERT_TYPE Ludovic Courtès
@ 2012-01-05 16:33 ` Andy Wingo
  1 sibling, 0 replies; 10+ messages in thread
From: Andy Wingo @ 2012-01-05 16:33 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-devel

Hi Mike,

On Fri 07 Oct 2011 09:00, Mike Gran <spk121@yahoo.com> writes:

> Is the SCM_ASSERT_TYPE macro considered to be a stable public API
> or internal to Guile?  It has never been mentioned in the manual,
> but both Lilypond and GNU Serveez have used it.

Yes, it is public.  We should document it.

> And what about the seldom-used SCM_ASRTGO?

No, this one is not.  In fact, it is gone in master.

Andy
-- 
http://wingolog.org/



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

* Re: SCM_ASSERT_TYPE
  2011-10-08 22:04 ` SCM_ASSERT_TYPE Ludovic Courtès
@ 2012-01-05 16:37   ` Andy Wingo
  2012-01-08  0:52     ` SCM_ASSERT_TYPE Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Wingo @ 2012-01-05 16:37 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Sat 08 Oct 2011 18:04, ludo@gnu.org (Ludovic Courtès) writes:

>> And what about the seldom-used SCM_ASRTGO?
>
> Likewise (Google Codesearch finds a couple of external users.)

Uf, I replied before I saw your message.  It is gone in master.  Do you
think we need to re-add it?  Codesearch found one project that used it.
I suggest reverting the addition to the manual.

Andy
-- 
http://wingolog.org/



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

* Re: SCM_ASSERT_TYPE
  2012-01-05 16:37   ` SCM_ASSERT_TYPE Andy Wingo
@ 2012-01-08  0:52     ` Ludovic Courtès
  2012-01-08 13:39       ` SCM_ASSERT_TYPE Andy Wingo
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2012-01-08  0:52 UTC (permalink / raw)
  To: guile-devel

Hi,

Andy Wingo <wingo@pobox.com> skribis:

> On Sat 08 Oct 2011 18:04, ludo@gnu.org (Ludovic Courtès) writes:
>
>>> And what about the seldom-used SCM_ASRTGO?
>>
>> Likewise (Google Codesearch finds a couple of external users.)
>
> Uf, I replied before I saw your message.  It is gone in master.  Do you
> think we need to re-add it?

Probably, as it doesn’t cost much and saves us a lengthy flame war.  ;-)

> Codesearch found one project that used it.  I suggest reverting the
> addition to the manual.

You mean it should be left undocumented?

I think ideally everything should be either documented or deprecated
(with a documented replacement).

Thanks,
Ludo’.




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

* Re: SCM_ASSERT_TYPE
  2012-01-08  0:52     ` SCM_ASSERT_TYPE Ludovic Courtès
@ 2012-01-08 13:39       ` Andy Wingo
  2012-01-08 15:47         ` SCM_ASSERT_TYPE Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Wingo @ 2012-01-08 13:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Sun 08 Jan 2012 01:52, ludo@gnu.org (Ludovic Courtès) writes:

>> On Sat 08 Oct 2011 18:04, ludo@gnu.org (Ludovic Courtès) writes:
>>
>>>> And what about the seldom-used SCM_ASRTGO?
>>>
> I think ideally everything should be either documented or deprecated
> (with a documented replacement).

I have now properly deprecated it in stable-2.0.  Is that OK? :-)

Cheers,

Andy
-- 
http://wingolog.org/



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

* Re: SCM_ASSERT_TYPE
  2012-01-08 13:39       ` SCM_ASSERT_TYPE Andy Wingo
@ 2012-01-08 15:47         ` Ludovic Courtès
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2012-01-08 15:47 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

Andy Wingo <wingo@pobox.com> skribis:

> On Sun 08 Jan 2012 01:52, ludo@gnu.org (Ludovic Courtès) writes:
>
>>> On Sat 08 Oct 2011 18:04, ludo@gnu.org (Ludovic Courtès) writes:
>>>
>>>>> And what about the seldom-used SCM_ASRTGO?
>>>>
>> I think ideally everything should be either documented or deprecated
>> (with a documented replacement).
>
> I have now properly deprecated it in stable-2.0.  Is that OK? :-)

Yes, thanks!

Ludo’.



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

end of thread, other threads:[~2012-01-08 15:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-02 16:16 SCM_ASSERT_TYPE Han-Wen Nienhuys
2003-07-02 22:48 ` SCM_ASSERT_TYPE Kevin Ryde
2003-07-02 23:01   ` SCM_ASSERT_TYPE Han-Wen Nienhuys
  -- strict thread matches above, loose matches on Subject: below --
2011-10-07 13:00 SCM_ASSERT_TYPE Mike Gran
2011-10-08 22:04 ` SCM_ASSERT_TYPE Ludovic Courtès
2012-01-05 16:37   ` SCM_ASSERT_TYPE Andy Wingo
2012-01-08  0:52     ` SCM_ASSERT_TYPE Ludovic Courtès
2012-01-08 13:39       ` SCM_ASSERT_TYPE Andy Wingo
2012-01-08 15:47         ` SCM_ASSERT_TYPE Ludovic Courtès
2012-01-05 16:33 ` SCM_ASSERT_TYPE Andy Wingo

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