emacs-devel
[Top][All Lists]
Advanced

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

`declare-function' at lexical let-closures; and last arg(s) that take ni


From: Emanuel Berg
Subject: `declare-function' at lexical let-closures; and last arg(s) that take nil made &optional
Date: Wed, 05 Apr 2023 10:59:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Just wrote a file [yanked last], actually, it is pretty
meaningless in the sense to be discussed here, but, it would
seem that one can make two points even from that short file,
namely

1. Functions inside lexical let-closures still needs
   `declare-function', even tho it should be pretty clear for
   everyone, even the byte-compiler one would think, that they
   are defined. Or am I wrong?

2. As for `declare-function', if we examine that just a little
   bit, it is clear that if and when a function's last
   argument has `nil' in its range, then that argument can be
   safely made &optional. The only situation when perhaps not
   to do it is when nil is a possible, but very unusual
   argument for that function, since it will be the de facto
   default argument this way.

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/w3m/w3m-swamp.el

(require 'w3m-tabs)

(let ((web-page-url "https://dataswamp.org/~incal";))

  (defun browse-swamp ()
    (interactive)
    (w3m-browse-url-new-tab web-page-url) )

  (declare-function browse-swamp nil)

  (defun insert-swamp ()
    (interactive)
    (insert web-page-url) )

  (declare-function insert-swamp nil)

  (defalias 'insert-page #'insert-swamp) )

(provide 'w3m-swamp)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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