Skip to content

Type checking etc in string conversions (xstring, convert-property-key, etc) #600

@kchanqvq

Description

@kchanqvq

There are a number of problems currently. Let's discuss here!

  1. convert-property-key currently doesn't support JS Symbol keys. We need to add internals.xpropkey for that.
  2. clstring% and jsstring implementation should be symmetric, but currently they are quite inconsistent. clstring does type check on CL side with internals.make_lisp_string handling only one type (JS string); jsstring miss typecheck, while internals.xstring also does some type dispatch (on JS string and numbers, is this necessary?).
  3. A bug:
Welcome to JSCL (version 0.9.0-alpha.0 built on 4 February 2026)

JSCL is a Common Lisp implementation on Javascript.
For more information, visit the project page at [GitHub](https://github.com/jscl-project/jscl).

CL-USER> (use-package :jscl/ffi)
T
CL-USER> (jsstring #(1 2))
TYPE-ERROR: #(1 2) is not a STRING.
    at https://jscl-project.github.io/jscl.js:42582:7
    at https://jscl-project.github.io/jscl.js:42585:3
    at JSCL_USER_ERROR (https://jscl-project.github.io/jscl.js:42586:3)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:2031:119
    at JSCL_USER_CLSTRING (https://jscl-project.github.io/jscl.js:2032:3)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at JSCL_USER_NIL (https://jscl-project.github.io/jscl.js:35436:36)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:35444:18
    at https://jscl-project.github.io/jscl.js:35445:3
    at JSCL_USER_CONVERTXSTRING (https://jscl-project.github.io/jscl.js:35446:3)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:35467:37
    at JSCL_USER_NIL (https://jscl-project.github.io/jscl.js:35468:3)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:36383:19
    at https://jscl-project.github.io/jscl.js:36384:3
    at https://jscl-project.github.io/jscl.js:36387:4
    at internals.bindSpecialBindings (https://jscl-project.github.io/jscl.js:536:12)
... 68 more frames, increase JSCL::*BACKTRACE-LIMIT* to view more
CL-USER> (funcall #'jsstring #(1 2))
#\SIMPLE-ERROR: ref vector out of range
    at https://jscl-project.github.io/jscl.js:42582:7
    at https://jscl-project.github.io/jscl.js:42585:3
    at internals.Symbol.JSCL_USER_ERROR [as fvalue] (https://jscl-project.github.io/jscl.js:42586:3)
    at internals.error (https://jscl-project.github.io/jscl.js:76:12)
    at https://jscl-project.github.io/jscl.js:9705:26
    at https://jscl-project.github.io/jscl.js:9707:3
    at JSCL_USER_AREF (https://jscl-project.github.io/jscl.js:9708:3)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:6695:27
    at https://jscl-project.github.io/jscl.js:6696:3
    at internals.Symbol.JSCL_USER_CHARNAME [as fvalue] (https://jscl-project.github.io/jscl.js:6697:3)
    at https://jscl-project.github.io/jscl.js:26341:205
    at JSCL_USER_WRITECHARAUX (https://jscl-project.github.io/jscl.js:26342:3)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:26460:54
    at https://jscl-project.github.io/jscl.js:26499:3
    at internals.Symbol.JSCL_USER_WRITEAUX [as fvalue] (https://jscl-project.github.io/jscl.js:26503:4)
    at JSCL_USER_NIL (https://jscl-project.github.io/jscl.js:26617:7)
    at internals.mvcall (https://jscl-project.github.io/jscl.js:66:10)
    at https://jscl-project.github.io/jscl.js:26626:18
... 23 more frames, increase JSCL::*BACKTRACE-LIMIT* to view more

and

JSCL> (funcall #'jsstring 3)
#\3

Originally posted by @davazp in #587

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions