Date: Sat, 13 Jun 2015 10:57:46 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Marcel Moolenaar <marcel@xcllnt.net> Cc: Ian Lepore <ian@freebsd.org>, David Chisnall <theraven@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, Alexander Kabaev <kabaev@gmail.com>, Marcel Moolenaar <marcel@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r284198 - head/bin/ls Message-ID: <CAJ-Vmok8vYcpEH4Ndk-uxKJ%2BYzKU1cH_xP_owct1r_6Emw7v1A@mail.gmail.com> In-Reply-To: <5D5E9A5C-0B8D-4194-9DB3-DB73253DF943@xcllnt.net> References: <201506100127.t5A1RdX6051959@svn.freebsd.org> <20150612204309.11dd3391@kan> <20150613024916.GA98218@troutmask.apl.washington.edu> <1434208622.1415.57.camel@freebsd.org> <C88CB169-12FE-4692-92AA-5C7D41BB61DF@FreeBSD.org> <1434210429.1415.65.camel@freebsd.org> <656256CF-58BF-492B-BA66-49B095407E9A@xcllnt.net> <CAJ-VmomYrSL4U%2BaCXoLFftX86oFJCFtvD91LDSGJbSD99L-QDA@mail.gmail.com> <5D5E9A5C-0B8D-4194-9DB3-DB73253DF943@xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 13 June 2015 at 10:06, Marcel Moolenaar <marcel@xcllnt.net> wrote: > >> On Jun 13, 2015, at 12:35 PM, Adrian Chadd <adrian@freebsd.org> wrote: >> >> Hi, >> >> I think we're at the point now where it's worth doing that >> re-evaluation. I don't think it's worth backing everything out; just >> whether the current approach of overriding printing the way it's done >> is the right way. >> >> So, how about that happens nowish before more things are converted? > > What do you suggest we do instead? So a lot of these things are table driven. Having manual printing for tabular data is plain stupid. The libbsdstat library for doing basic statistics output with "now" and "time series" is what I'm playing with right now. It's only used by sam's wifi utilities, but I'm going to try and extend it for other utilities too (like netstat, vmstat, etc style output.) That way what's expressed in code is organised as such: * a bit of code fetches statistics * a bit of code sets up what the name of each field is, and what the units are * a bit of code handles any odd corner cases with data representations * libbsdstat takes care of recording the samples into the time-series or 'now' section, figuring out which fields need to be printed in which order, what the formatting is, etc. * .. I'm extending it to print out json for its table outputs versus just plain text. Having arbitrary formatting, arbitrary printing, random places where statistics are fetched, etc is actually the terrible problem that we could do better, without losing our minds by overcomplicating it with C++, templating, grammars, etc - and ending up with what look like five layers of nested java classes that do "Setter(ToString(Getter())" in layers. -adrian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmok8vYcpEH4Ndk-uxKJ%2BYzKU1cH_xP_owct1r_6Emw7v1A>