Lisp HUG Maillist Archive

MAKE-STRING not defaulting to element-type 'character ?!

Hi -

I have the following "problem“: (make-string 255) does not make a string with element type character but with type base-char. This is on Lispworks 7 Professional.

Can anyone confirm that this is a bug?

Thanks!

Regards

  Frank


Re: MAKE-STRING not defaulting to element-type 'character ?!


> On 17 Jan 2016, at 12:42 , Frank Gönninger, Gönninger B&T <frank.goenninger@goenninger.net> wrote:
> 
> Hi -
> 
> I have the following "problem“: (make-string 255) does not make a string with element type character but with type base-char. This is on Lispworks 7 Professional.
> 
> Can anyone confirm that this is a bug?

(Probably) not a bug: make-string takes a :key argument element-type that has an implementation-defined default. For Lispworks, this default comes from the variable lw:*default-character-element-type*, which should be set by calling #'lw:set-default-character-element-type. For a fresh Lispworks 7 image, lw:*default-character-element-type* has the value 'base-char, which is exactly what you're seeing.

The TL;DR version is something like "if you want make-string to return strings of specific a character type, you need to specify it."

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: MAKE-STRING not defaulting to element-type 'character ?!

Raymond Wiker <rwiker@gmail.com> writes:

>> On 17 Jan 2016, at 12:42 , Frank Gönninger, Gönninger B&T <frank.goenninger@goenninger.net> wrote:
>> 
>> Hi -
>> 
>> I have the following "problem“: (make-string 255) does not make a string with element type character but with type base-char. This is on Lispworks 7 Professional.
>> 
>> Can anyone confirm that this is a bug?
>
> (Probably) not a bug: make-string takes a :key argument element-type
> that has an implementation-defined default.

In case it's not clear from Frank's reply, make-string's default value
for element-type *is* specified to be CHARACTER. It is the
INITIAL-ELEMENT that is implementation-dependent.

Zach

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:32 UTC