From owner-freebsd-questions@freebsd.org Thu May 14 21:42:53 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D44DA2E0D3A for ; Thu, 14 May 2020 21:42:53 +0000 (UTC) (envelope-from mail@ozzmosis.com) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49NQ4r4YwSz3ysP for ; Thu, 14 May 2020 21:42:52 +0000 (UTC) (envelope-from mail@ozzmosis.com) Received: from blizzard.ozzmosis.com (167-179-139-56.a7b38b.mel.nbn.aussiebb.net [167.179.139.56]) (Authenticated sender: ozzmosis@ozzmosis.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 3BA8F240007; Thu, 14 May 2020 21:42:50 +0000 (UTC) Received: by blizzard.ozzmosis.com (Postfix, from userid 1001) id 6772E51B06; Fri, 15 May 2020 07:42:45 +1000 (AEST) Date: Fri, 15 May 2020 07:42:45 +1000 From: andrew clarke To: Tim Daneliuk Cc: FreeBSD Mailing List Subject: Re: Multi-line text output via printf() et al. Message-ID: <20200514214245.tn36ajhtppielugg@ozzmosis.com> References: <20200514220904.7a4c1e28.freebsd@edvax.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20200501 X-Rspamd-Queue-Id: 49NQ4r4YwSz3ysP X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mail@ozzmosis.com designates 217.70.178.230 as permitted sender) smtp.mailfrom=mail@ozzmosis.com X-Spamd-Result: default: False [-3.96 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_NEUTRAL(0.00)[230.178.70.217.rep.mailspike.net : 127.0.0.13]; RCVD_IN_DNSWL_LOW(-0.10)[230.178.70.217.list.dnswl.org : 127.0.5.1]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:217.70.178.192/26:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[ozzmosis.com]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; IP_SCORE(-1.56)[ip: (-4.93), ipnet: 217.70.176.0/20(-1.60), asn: 29169(-1.28), country: FR(-0.00)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:29169, ipnet:217.70.176.0/20, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2020 21:42:53 -0000 On 2020-05-14 15:44:18, Tim Daneliuk (tundra@tundraware.com) wrote: > Warning - Pet Peeve follows, ignore me if you think it's stupid ... > > However you decide to do it, can we _please_ stop embedding literal strings > in printf(), python print(), and so forth? Strings should be pulled out > as variables into one centrally maintained location in the code. Why? > Because, someday, you may actually want to have your code run with output > in something other than your native language. Because strings are often > reused in several places in the code. Because you may someday actually > want to use unicode characters. Fundamentally I agree but doing this opens a can of worms that I suspect many coders would prefer not to deal with, especially for hobby projects that form the basis of many open source programs. And rightly or wrongly, literal strings do act as documentation. Also for modern languages like Python and C# 6.0 there's the problem of refactoring expressions written into string literals. It's not ideal to have these strings strongly decoupled from the code they're associated with. > You haven't lived until you've had to scour thousands of lines of code > looking for literal strings or having those strings embedded symbolically, > deep down in the guts of the code. There should be tools that can help with this.