From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Sat, 21 Nov 2015 09:01:12 +0000 Message-ID: References: <83k2ptq5t3.fsf@gnu.org> <87h9kxx60e.fsf@lifelogs.com> <877flswse5.fsf@lifelogs.com> <8737wgw7kf.fsf@lifelogs.com> <87io5bv1it.fsf@lifelogs.com> <87egfzuwca.fsf@lifelogs.com> <876118u6f2.fsf@lifelogs.com> <8737w3qero.fsf@lifelogs.com> <831tbn9g9j.fsf@gnu.org> <878u5upw7o.fsf@lifelogs.com> <83ziya8xph.fsf@gnu.org> <83y4du80xo.fsf@gnu.org> <837fld6lps.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bb04dc4707b510525093c14 X-Trace: ger.gmane.org 1448096503 10631 80.91.229.3 (21 Nov 2015 09:01:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Nov 2015 09:01:43 +0000 (UTC) Cc: aurelien.aptel+emacs@gmail.com, tzz@lifelogs.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 21 10:01:43 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a043B-0005Ux-0x for ged-emacs-devel@m.gmane.org; Sat, 21 Nov 2015 10:01:41 +0100 Original-Received: from localhost ([::1]:51540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a043A-0002xc-3k for ged-emacs-devel@m.gmane.org; Sat, 21 Nov 2015 04:01:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a042w-0002xV-Ba for emacs-devel@gnu.org; Sat, 21 Nov 2015 04:01:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a042v-0002mu-0z for emacs-devel@gnu.org; Sat, 21 Nov 2015 04:01:26 -0500 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:38526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a042t-0002mX-6v; Sat, 21 Nov 2015 04:01:23 -0500 Original-Received: by wmec201 with SMTP id c201so48278920wme.1; Sat, 21 Nov 2015 01:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=sDySiylMAlp6KIQEOddXlN106ViZ1Xug24Ic9G/Itcs=; b=JC+A998giOfv/F5Pzv38/982Iygs1g3rhMsRFuA1L5w4LIsoIvtpXmcYPkyL8lGZGm PaqETxAHmSPyy4ptb5kl7WwilL4ssN9k79sZgdf5zVUyQzdYzcC0XKbXKewlzzeiPSGW DxeAAr38vDdKYhXfP/aARWFs3EhTY089MvzU9dGnlFin18R++ZnHpPzIJYuTUuHlz7FM uxkSpRmeEBZIBTRueTvZs99YS+ACp8rz3MtlFhsfU7/XRORkiEkwDqDyrktopiKJt63d 4dDYiI2u3GmokzutETatuSFCIJ46xqjamsrn6J+AATnOd747T84xvHTiD7kzl8ouVfE5 WfQw== X-Received: by 10.195.13.135 with SMTP id ey7mr18894504wjd.25.1448096482489; Sat, 21 Nov 2015 01:01:22 -0800 (PST) In-Reply-To: <837fld6lps.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:194928 Archived-At: --047d7bb04dc4707b510525093c14 Content-Type: text/plain; charset=UTF-8 Eli Zaretskii schrieb am Fr., 20. Nov. 2015 um 10:54 Uhr: > > > Re this fragment from module.c: > > > > Lisp_Object ret = list4 (Qlambda, > > list2 (Qand_rest, Qargs), > > documentation ? build_string (documentation) : Qnil, > > list3 (module_call_func, > > envobj, > > Qargs)); > > > > Thou shalt not use build_string, except when you _know_ the argument > > will always be a pure-ASCII string. Practically, this means the > > argument must be a constant ASCII string. See these messages (and the > > preceding discussion, if you are interested) for the gory details: > > > > > http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00955.html > > > http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00976.html > > > http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00979.html > > > > The above should call make_multibyte_string instead. > > > > > > We had a discussion about encodings in > > https://github.com/aaptel/emacs-dynamic-module/issues/37. Sorry that > this > > didn't get resolved earlier; it's an important point. My suggestion > would be to > > always mandate specifying an encoding whenever a char* is passed, and > limit > > that to two or three functions dealing with creating strings and > accessing > > string contents. Would that address your concerns? > > No, this is not about encoding at all. This is about calling > build_string: you should only call it when the argument is a fixed > ASCII string. If the argument is not fixed or might include non-ASCII > characters, you should call make_multibyte_string instead. That's > because build_string might decide on its own whether to produce a > unibyte or a multibyte string, out of your control, whereas we always > want a multibyte string in this context. > > build_string doesn't encode or decode its argument, it creates a Lisp > object whose text is taken from the argument. It's similar to > make_number in that respect. > > Let me summarize the issues I see: The internal Emacs encoding can change between versions (command in mule-conf.el), therefore we shouldn't use it in the module API. IIUC this rules out make_multibyte_string: it only accepts the internal encoding. Therefore I proposed to always have users specify the encoding explicitly and then use code_convert_string_norecord to create the Lisp string objects. Would that work? (We probably then need another set of functions for unibyte strings.) --047d7bb04dc4707b510525093c14 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Fr., 20. Nov. 2015 um 10:54=C2=A0Uhr:

>=C2=A0 =C2=A0 =C2=A0Re this fragment from module.c:
>
>=C2=A0 =C2=A0 =C2=A0Lisp_Object ret =3D list4 (Qlambda,
>=C2=A0 =C2=A0 =C2=A0list2 (Qand_rest, Qargs),
>=C2=A0 =C2=A0 =C2=A0documentation ? build_string (documentation) : Qnil= ,
>=C2=A0 =C2=A0 =C2=A0list3 (module_call_func,
>=C2=A0 =C2=A0 =C2=A0envobj,
>=C2=A0 =C2=A0 =C2=A0Qargs));
>
>=C2=A0 =C2=A0 =C2=A0Thou shalt not use build_string, except when you _k= now_ the argument
>=C2=A0 =C2=A0 =C2=A0will always be a pure-ASCII string. Practically, th= is means the
>=C2=A0 =C2=A0 =C2=A0argument must be a constant ASCII string. See these= messages (and the
>=C2=A0 =C2=A0 =C2=A0preceding discussion, if you are interested) for th= e gory details:
>
>=C2=A0 =C2=A0 =C2=A0http://= lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00955.html
>=C2=A0 =C2=A0 =C2=A0http://= lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00976.html
>=C2=A0 =C2=A0 =C2=A0http://= lists.gnu.org/archive/html/bug-gnu-emacs/2013-10/msg00979.html
>
>=C2=A0 =C2=A0 =C2=A0The above should call make_multibyte_string instead= .
>
>
> We had a discussion about encodings in
> https://github.com/aaptel/emacs-dynamic= -module/issues/37. Sorry that this
> didn't get resolved earlier; it's an important point. My sugge= stion would be to
> always mandate specifying an encoding whenever a char* is passed, and = limit
> that to two or three functions dealing with creating strings and acces= sing
> string contents. Would that address your concerns?

No, this is not about encoding at all.=C2=A0 This is about calling
build_string: you should only call it when the argument is a fixed
ASCII string.=C2=A0 If the argument is not fixed or might include non-ASCII=
characters, you should call make_multibyte_string instead.=C2=A0 That's=
because build_string might decide on its own whether to produce a
unibyte or a multibyte string, out of your control, whereas we always
want a multibyte string in this context.

build_string doesn't encode or decode its argument, it creates a Lisp object whose text is taken from the argument.=C2=A0 It's similar to
make_number in that respect.


Let me summarize the issues I see: The= internal Emacs encoding can change between versions (command in mule-conf.= el), therefore we shouldn't use it in the module API. IIUC this rules o= ut make_multibyte_string: it only accepts the internal encoding. Therefore = I proposed to always have users specify the encoding explicitly and then us= e code_convert_string_norecord to create the Lisp string objects. Would tha= t work? (We probably then need another set of functions for unibyte strings= .)
--047d7bb04dc4707b510525093c14--