bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33375: 27.0.50; Nested function definitions


From: Eli Zaretskii
Subject: bug#33375: 27.0.50; Nested function definitions
Date: Wed, 14 Nov 2018 17:40:12 +0200

> From: Andreas Röhler <andreas.roehler@easy-emacs.de>
> Date: Wed, 14 Nov 2018 11:06:52 +0100
> 
> (defun foo1 ()
>    "[Some docu]
> 
> (defun other-foo "
>    (interactive)
>    ;; defining another function inside
>    (defun foo2 ()
>      (interactive)
>      (message "%s"   "Foo2")
> ;; another syntactically correct function just badly indented
> (defun foo3 ()
>    (interactive)
>    (message "%s" "Foo3"))
>        )
>    (message "%s" "Foo1"))
> 
> ;;;;
> Results of evaluation:
> 
> (foo1) ==> "Foo1"
> (foo2) ==> foo3 ?
> (foo3) ==> "Foo3"

Why do you think there's anything wrong here?  AFAICT, each evaluation
returns the last sexp evaluated in the respective function.  foo1 and
foo3 have a call to 'message' as the last sexp, so they return the
message string, but foo2's last sexp evaluates a defun form, so you
get the result of that, which is the function foo3.  IMO, this is
expected and correct behavior.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]