mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Luca Barbato <lu_zero@gentoo.org>
To: musl@lists.openwall.com
Subject: Re: Best place to discuss other lightweight libraries?
Date: Tue, 23 Apr 2013 00:42:01 +0200	[thread overview]
Message-ID: <5175BCB9.5090309@gentoo.org> (raw)
In-Reply-To: <20130422215248.GR20323@brightrain.aerifal.cx>

On 04/22/2013 11:52 PM, Rich Felker wrote:
>> For this there aren't solution that won't cause different problems I'm
>> afraid.
> 
> Sure there are. I get the impression you can tell I was talking about
> libav/ffmpeg's log interface. :-) The obvious solution is to bind log
> contexts to the object you're acting on. See this nice talk:
> 
> http://misko.hevery.com/2008/11/21/clean-code-talks-global-state-and-singletons/
> 
> If I remember right, part of the problem way back was that there were
> deep function calls that had no context available to them, and that
> didn't _need_ a context for anything but logging warnings or whatnot.

In the specific case yes. I tried to foster proper return error
propagation, so you get something more meaningful than EINVAL/-1 and
that is usually enough in those specific cases.

The general problem is that the library user wants to be the only one
having a say on what goes where so single point overrides are useful.

When you start using those libraries in situations in which you'd like
to have per-$situation logging then you start to scream.

(In the specific case above there is a quite borderline solution since
we can override the global logger and store per context loggers in
creative ways)

> Really, the fact that they can fail and want to be able to report
> failure means they _do_ need a context, but I can understand the
> desire to cheat, especially if there's a performance cost to passing
> the context all the way down. In that case, hidden non-global state,
> namely thread-local storage, might be an appropriate solution. It's
> still hidden state (and thus A Bad Thing), but at least it's no longer
> global state.

Exactly. (bonus points if you do that in a void returning function...)

>>> - Designs based on shared libraries, especially lots of them. This
>>>   creates bloat and often interferes with the ability to use static
>>>   linking.
>>
>> Special mention to those that want to do clever stuff on the init
>> section (e.g. change a program global state from there)
> 
> Did whatever lib did that (OpenAL, was it?) ever fix their bugs?

Given recent binutils would strip away symbols if used that way, making
linking fail, I hope so.

> Yes, basically. Dependency on glib means your library will impose
> bloat and it will preclude robustness.

Yet glib gives you oh-so-many-features (I fell for it once), sadly there
aren't many utility libs that provide sort of useful data structures,
eventloops, threadpools and portable string mangling (e.g. strl*
functions) in a single widespread package.

Some lean/cleaned up alternative are cropping but usually they aren't as
known and widespread.

lu




  reply	other threads:[~2013-04-22 22:42 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21 16:30 LM
2013-04-21 20:17 ` Rob Landley
2013-04-21 20:24 ` Rob Landley
2013-04-24 11:39   ` LM
2013-04-25 19:30     ` Rob Landley
2013-04-21 23:26 ` Isaac Dunham
2013-04-22 14:53 ` Rich Felker
2013-04-22 15:21   ` Luca Barbato
2013-04-22 16:40     ` LM
2013-04-22 16:47       ` Daniel Cegiełka
2013-04-22 22:07         ` Rich Felker
2013-04-23 12:50           ` LM
2013-04-23 14:40             ` John Spencer
2013-04-23 14:58               ` Rich Felker
2013-04-22 19:31       ` Luca Barbato
2013-04-22 23:24       ` Rob Landley
2013-04-22 23:31         ` Rich Felker
2013-04-23  0:54           ` Rob Landley
2013-04-23  1:46             ` Rich Felker
2013-04-23  5:04               ` Isaac Dunham
2013-04-23 13:47                 ` Rich Felker
2013-04-23 21:25                   ` Luca Barbato
2013-04-23 21:50                   ` Kurt H Maier
2013-04-24  2:37                     ` Rich Felker
2013-04-24  4:43                       ` Kurt H Maier
2013-04-24 13:37                         ` Rich Felker
2013-04-24  0:50                   ` idunham
2013-04-24  6:11                 ` Rob Landley
2013-04-22 21:52     ` Rich Felker
2013-04-22 22:42       ` Luca Barbato [this message]
2013-04-22 23:06         ` Rich Felker
2013-04-23  0:26           ` Luca Barbato
2013-04-23  2:14             ` Rob Landley
2013-04-23 19:07               ` Strake
2013-04-23 19:24                 ` Daniel Cegiełka
2013-04-23 21:33                   ` Szabolcs Nagy
2013-04-24 12:12                     ` Zvi Gilboa
2013-04-23 21:34               ` Luca Barbato
2013-04-24 11:18                 ` Daniel Cegiełka
2013-04-24 11:48                   ` Kurt H Maier
2013-04-24 12:32                     ` Daniel Cegiełka
2013-04-24 13:38                       ` Rich Felker
2013-04-24 13:55                         ` Daniel Cegiełka
2013-04-24 13:37                     ` go support (was: Best place to discuss other lightweight libraries?) John Spencer
2013-04-24 13:39                       ` Rich Felker
2013-04-24 16:33                       ` Kurt H Maier
2013-04-24 15:47                     ` Best place to discuss other lightweight libraries? Szabolcs Nagy
2013-04-24 19:17                       ` Rich Felker
2013-04-25  6:40                         ` Szabolcs Nagy
2013-04-25 19:37                     ` Rob Landley
2013-04-24 13:28                   ` go support (was: Best place to discuss other lightweight libraries?) John Spencer
2013-04-24 13:42                     ` Rich Felker
2013-04-24 14:06                   ` Best place to discuss other lightweight libraries? Christian Neukirchen
2013-04-29 11:41                     ` Daniel Cegiełka
2013-04-29 16:31                       ` Go (was: [musl] Best place to discuss other lightweight libraries?) John Spencer
2013-04-29 16:44                         ` Daniel Cegiełka
2013-04-23  0:31       ` Best place to discuss other lightweight libraries? Rob Landley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5175BCB9.5090309@gentoo.org \
    --to=lu_zero@gentoo.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).