From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: [modules] Possible return values of the env->type_of? Date: Fri, 22 Jun 2018 10:41:35 -0400 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1529678605 17474 195.159.176.226 (22 Jun 2018 14:43:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Jun 2018 14:43:25 +0000 (UTC) To: Help Gnu Emacs mailing list , =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 22 16:43:21 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fWNHS-0004Pb-Vx for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Jun 2018 16:43:19 +0200 Original-Received: from localhost ([::1]:34494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWNJa-00080U-9f for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Jun 2018 10:45:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWNG2-0005s7-Ei for help-gnu-emacs@gnu.org; Fri, 22 Jun 2018 10:41:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWNG1-00036O-Bm for help-gnu-emacs@gnu.org; Fri, 22 Jun 2018 10:41:50 -0400 Original-Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:42624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fWNG1-00036E-2x for help-gnu-emacs@gnu.org; Fri, 22 Jun 2018 10:41:49 -0400 Original-Received: by mail-lf0-x233.google.com with SMTP id z207-v6so9110995lff.9 for ; Fri, 22 Jun 2018 07:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=889Bz5dzC1roufgauof5/C67G9qFXcyJHHPA/0UjW3I=; b=Oz5eUiujJ4pTImFJEs55bVYywMSXFus9J5Qzb6+fPjYzD3O4aZ3YwFoIBqparIAY/J gyg3m71LIyJh+g5TvAdr82I0Op2UtX9UbVHUANdl91SdCEumyyCNoPg3yKWc6SB8zqL1 +QdM29CuwKMRpt2qkn+P/C7mhe2ywKOHWZhjMGBoddnyegGdSp08kvHSIh7ds0cb7xig tBO27fBDEyhtm+wpJweuaQ2GhWcjzH95x85m5MVPwVvR3qxwO/aXuYxgxo4LK9nXlKXC 9tTRsIHg0gBYX8Obia8VT3KE6B3vgzilxUWTzIv9ZBA2UW38iMjV15GjxAvZEv52Cf5X WzfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=889Bz5dzC1roufgauof5/C67G9qFXcyJHHPA/0UjW3I=; b=Ye8AuH+vfB147ei22rLbUGRFcUjts4fXuCpOtBFJ9XNGAU7bv7Ob/ZOHlboEsgOHKO +m/vqwUNgnL/Uc4wCWTbBaNZieO9AsyX8QOpr059dpSm7NzHrVFapUUTOVOsNU08PkLH cIIP5VkBfeMJSsdY7dYJos2h5bupv5xWaI6pMdgGLlAJnXEo+kdhkQ5TiE42onLb0j4J WbgPteHihgbFW33tMb2+cJIHdrFbXagiybNdLvVcaksZduB1+zDa/kBeXUsD4aUtRwda 7yHh9Njoc2cWV3SDokILJrsHBxRJfEF45jdtISr8PMSzz4NVK7NwDcFe0HelZKkzGA9G Z2rw== X-Gm-Message-State: APt69E2ABUC3U8AhxjkaEx6VahpttPu5Zb0A0qsiAJ47H+oxKKZJ3FOt +XyFIVjKQEWtIUzdX/Vt1CclS5rbHdwWghp6BcY= X-Google-Smtp-Source: ADUXVKITAI7SuK/+ww2Mf/ZmwJaMPG1yVQNwbV3+B4cNm3o1VgRiXT8rRQWy6MG78W+H9FhgR9a9D1OByVg1tpV1t9k= X-Received: by 2002:a2e:1790:: with SMTP id 16-v6mr1457500ljx.101.1529678507304; Fri, 22 Jun 2018 07:41:47 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::233 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:117251 Archived-At: Hello, What are all the possible return values of the type_of function in the Dynamic Modules API? I am playing with Nim Emacs Modules[1], and interestingly the symbol returned by type_of for lists is 'cons too. >From [2]: (ert-deftest modtest-get-type () (should (eq 'string (modtest-get-type "abc"))) (should (eq 'integer (modtest-get-type 42))) (should (eq 'float (modtest-get-type 42.0))) (should (eq 'symbol (modtest-get-type nil))) (should (eq 'symbol (modtest-get-type t))) (should (eq 'symbol (modtest-get-type '()))) (should (eq 'cons (modtest-get-type (cons 1 2)))) (should (eq 'cons (modtest-get-type '(1 . 2)))) (should (eq 'cons (modtest-get-type '(1 2 3)))) ;Interestingly, this is a "cons" too. (should (eq 'cons (modtest-get-type (list 1 2 3))))) ;.. and this too! Below code[3] is in Nim that creates that Elisp modtest-get-type function; it's a light wrapper that calls the type_of Modules API function: emacs.defun(get_type, 1): ## Returns the Emacs-Lisp symbol of the argument type. env.type_of(env, args[0]) Is this expected? I was expecting the type symbol returned for the last two tests above to be 'list. [1]: https://github.com/kaushalmodi/nim-emacs-module [2]: https://github.com/yuutayamada/nim-emacs-module/blob/f7ee0c886c67707612c6b2a62f17025b083e2aca/test/test-modtest.el#L30-L40 [3]: https://github.com/yuutayamada/nim-emacs-module/blob/f7ee0c886c67707612c6b2a62f17025b083e2aca/test/modtest.nim#L161-L163 -- Kaushal Modi