From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: divoplade Newsgroups: gmane.lisp.guile.user Subject: What is the point of bytevectors? Date: Sat, 12 Sep 2020 09:49:53 +0200 Message-ID: <663bcc3f7ca042bfd727cbcecb0dccfcde43aec8.camel@divoplade.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32960"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Sep 12 09:51:31 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kH0Jm-0008TD-Ru for guile-user@m.gmane-mx.org; Sat, 12 Sep 2020 09:51:30 +0200 Original-Received: from localhost ([::1]:47600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kH0Jl-0008Vu-Uk for guile-user@m.gmane-mx.org; Sat, 12 Sep 2020 03:51:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kH0Ia-0007RU-O2 for guile-user@gnu.org; Sat, 12 Sep 2020 03:50:16 -0400 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kH0IY-0005aA-2n for guile-user@gnu.org; Sat, 12 Sep 2020 03:50:16 -0400 X-Originating-IP: 86.194.83.229 Original-Received: from divoplade.home (lfbn-lyo-1-1007-229.w86-194.abo.wanadoo.fr [86.194.83.229]) (Authenticated sender: d@divoplade.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 0C4E01C0007 for ; Sat, 12 Sep 2020 07:50:08 +0000 (UTC) Received-SPF: pass client-ip=217.70.183.197; envelope-from=d@divoplade.fr; helo=relay5-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/12 03:50:09 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16905 Archived-At: Hello guile users, I am writing a library mixing some scheme code and C code, and I have two options for interfacing C strings: 1. Use bytevectors; 2. Use strings with byte access semantics (so-called latin-1, which is really a misleading name since it will most certainly contain utf-8- encoded unicode text). >From the C side, they have nearly identical APIs, and the conversion functions do not transcode anything. >From the scheme side, however: 1. The bytevector library needs to be imported; 2. The function names have way more characters to type; 3. The bytevector library is missing a lot of text functions (like join, split, trim, pad, searching...). If the user wants to always manipulate unicode (decoded) strings, using either bytevectors or latin-1 strings require transcoding to enter the library and to exit the library, so either option is valid. But if the user wants to always manipulate utf-8-encoded strings [1], using bytevectors is impossible or much more difficult (see points above). So, why should I ever use bytevectors? divoplade [1] https://utf8everywhere.org/