From owner-freebsd-current@freebsd.org Sun Nov 15 18:14:59 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5A42A2FAF6 for ; Sun, 15 Nov 2015 18:14:59 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id B42181F26 for ; Sun, 15 Nov 2015 18:14:59 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id A9B05DC2C; Sun, 15 Nov 2015 18:14:58 +0000 (UTC) Subject: Re: libXO-ification - Why - and is it a symptom of deeper issues? To: Garrett Cooper References: <0650CA79-5711-44BF-AC3F-0C5C5B6E5BD9@rdsor.ro> <5648C964.2020405@freebsd.org> <2DF061E9-2541-4B10-9744-C49C515FF672@gmail.com> Cc: freebsd-current@freebsd.org From: Allan Jude Message-ID: <5648CBA1.9010300@freebsd.org> Date: Sun, 15 Nov 2015 13:14:57 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <2DF061E9-2541-4B10-9744-C49C515FF672@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bDeksebbs7N90hkbf9EdKm51onWeKu0H7" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2015 18:14:59 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bDeksebbs7N90hkbf9EdKm51onWeKu0H7 Content-Type: text/plain; charset=shift_jis Content-Transfer-Encoding: quoted-printable On 2015-11-15 13:10, Garrett Cooper wrote: >=20 >> On Nov 15, 2015, at 10:05, Allan Jude wrote: >> >>> On 2015-11-15 07:54, Dan Partelly wrote: >>> >>> Hi all, >>> >>> I was looking at the new facility of dumping JSON,XML from many utils= in base and after some funny minutes, I couldn't stop ask myself =81g Ok= , this is funny , but why ? =81g And I couldn't find a real answer. Ill o= utline what I think: >>> >>> >>> 1. Undoubtedly, it makes base code slightly harder to understand and = maintain. >> >> I am not sure that libxo actually makes the code any harder to >> understand and maintain. It might actually make it slightly better. >> >> replacing: >> >> printf("%s %s %d\n", foo, bar, number); >> >> with: >> >> xo_emit("{:foo/%s} {:bar/%s} {:number/%d}", foo, bar, number); >> >> it not really hurting much. >=20 > That's by and large true, but there are other APIs that need to be call= ed on exit (xo_finish?) and in other scenarios where flushing, etc is nee= ded. If you don't do that, you don't get the output you expect (which bro= ke uptime/w several months ago..). You can setup an atexit() call to call xo_finish automatically when the program exits. The original changes to uptime had a few other issues, which I fixed. >=20 > Also, typos with the meta language into the xo_emit calls have bit is m= ore than once ;(. >=20 Yes, but, a typo in any change is likely to cause a problem. This is not a problem unique to libxo. --=20 Allan Jude --bDeksebbs7N90hkbf9EdKm51onWeKu0H7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJWSMuhAAoJEBmVNT4SmAt+lugP/2UPm2RiJ3zj8IHTBFmOROI8 +/GmRtX4g0jIz8JR55ZB9SQAQ8ItUVlMMT1V11zjgWGfw+DsJGVXYT3v+2D66zzg TX4c1FaIlUR2M/xBb0j9tq5xCIc1O7TXl5PTv/hvV/KWFVWOhq2gbEr5Dq0XEIm5 GVMzx86lAdewRn3qEniX9l1MTvMJM7DdVZdH54N6kSxJOO9ays+31tAM0DiaS1Ef DVhH+l0dU4Aeq/c5s+1yBjaj5b9X1Q3/JfGuM6i6D86/1Y04f6CEww5Cd3+jPpOr hySx09BlfAmwQQEKxHn+tV+AdrIpKl2RXBAlpi29hj/Im8Pk4zXc7+8kzj0fFAf8 LLibWal39CkCWS6+f+/NIiBc33pJDuiJcWeoPS1VSqKpHyzgFalJmfg7hDNijGaq dpLOpStU9c7SCbunzFTDIc+S9ZkCydLtBDR6cwRWfcbwuAp9i7Z1g3yl6yyLa3Zc iSIrbsn+VLWsbp9W3LhhY58h1ma53jUjIzNae/dYSY+qluIiHg6qfTCnIuhrhVXJ LK/YdS2qiCYnb8TyvZ49AUa+kq3rSLvJvZWV/mvgxq4KZs0/8rB4lrS7ngXtJu5Y 4k+Cci8z/SKzQoyscb+1Dag7Ld3fPJwaRf88pEjsmWKaLmp/pMZhxm7AhJzHhRAo Sxe0YBSMXfe0iRE+8FsT =zedu -----END PGP SIGNATURE----- --bDeksebbs7N90hkbf9EdKm51onWeKu0H7--