[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Don't use PROGN for an IF clause

james

11/26/2015 8:40:00 AM

https://google.github.io/styleguide/lispguide.xml#Conditional_E... says
"However, don't use PROGN for an IF clause -- use COND, WHEN, or UNLESS."

Any reasons for this?
4 Answers

Paul Rubin

11/26/2015 9:13:00 AM

0

james <dinglei2008@gmail.com> writes:
"However, don't use PROGN for an IF clause -- use COND, WHEN, or UNLESS."
> Any reasons for this?

It's just ugly.

Pascal J. Bourguignon

11/26/2015 10:35:00 AM

0

james <dinglei2008@gmail.com> writes:

> https://google.github.io/styleguide/lispguide.xml#Conditional_E... says
> "However, don't use PROGN for an IF clause -- use COND, WHEN, or UNLESS."
>
> Any reasons for this?

You can easily ignore style guides, by acquiring your own artistic
taste.

For example, you could find that it's easy to avoid PROGN in a IF,
because you will often have to use LET, FLET, HANDLER-CASE,
UNWIND-PROTECT or any other kind of operator that let you have several
forms inside anyways.

So you can easily make an artistic exception for the rare PROGN you want
to use there.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

William James

11/26/2015 2:54:00 PM

0

Pascal J. Bourguignon wrote:

> james <dinglei2008@gmail.com> writes:
>
> > https://google.github.io/styleguide/lispguide.xml#Conditional_E... says
> > "However, don't use PROGN for an IF clause -- use COND, WHEN, or UNLESS."
> >
> > Any reasons for this?
>
> You can easily ignore style guides, by acquiring your own artistic
> taste.
>
> For example, you could find that it's easy to avoid PROGN in a IF,
> because you will often have to use LET, FLET, HANDLER-CASE,
> UNWIND-PROTECT or any other kind of operator that let you have several
> forms inside anyways.
>
> So you can easily make an artistic exception for the rare PROGN you want
> to use there.

Ocaml:

if true then (print_endline "a";print_endline "b") else print_int 8;;
===>
a
b

--
He has nothing but kind sentiments for those who would destroy his home and
family.... He is universally tolerant.... If he has any principles, he keeps
them well concealed.... He is, to the extent of his abilities, exactly like
the next citizen, who, he trusts, is trying to be exactly like him: a faceless,
characterless putty-man. --- Father Feeney; "Should Hate Be Outlawed?"

james

11/27/2015 2:45:00 AM

0

On Thursday, November 26, 2015 at 6:35:21 PM UTC+8, informatimago wrote:
> james <dinglei2008@gmail.com> writes:
>
> > https://google.github.io/styleguide/lispguide.xml#Conditional_E... says
> > "However, don't use PROGN for an IF clause -- use COND, WHEN, or UNLESS."
> >
> > Any reasons for this?
>
> You can easily ignore style guides, by acquiring your own artistic
> taste.
>
> For example, you could find that it's easy to avoid PROGN in a IF,
> because you will often have to use LET, FLET, HANDLER-CASE,
> UNWIND-PROTECT or any other kind of operator that let you have several
> forms inside anyways.
>
> So you can easily make an artistic exception for the rare PROGN you want
> to use there.
>
> --
> __Pascal Bourguignon__ http://www.informat...
> "The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment." -- Carl Bass CEO Autodesk

Yes, thanks to clarify this.