Singpolyma

's Profile

Author Archive

Creative Freedom for Children Who Become Adults

Posted on

Our children are the most creative component of our society. They are the great remixers. They absorb the culture that they are surrounded by, and create their own pictures and stories and songs. We hang these on our fridge, or listen, or sing along. We’re all proud of our little creators.

Children love to remix because they love to imitate. Give a child a Mickey Mouse colouring book and soon they’ll be drawing Mickey too. Watch Frozen and hear new stories about Elsa and Anna for weeks to come. We don’t give this a second thought. Surely copyright concerns are for other people, maybe teenagers making electronic music and anime music videos. Copyright need not apply here, in our children’s crayons.

Sure, I’ve not yet heard of a lawsuit being brought over a small child’s drawings, but children grow up. I’d like to talk about what happens when they do.

My sister, for instance, has grown up, gotten married, and is looking hard at what she wants to do with her life. What she enjoys most is creating visual art. So when she started taking commissions for paintings, what do you think she wanted to paint? What do you think people wanted her to paint? Disney characters, of course, the characters that she and her clients were so close to as children.

You can see examples of this everywhere. YouTube, DeviantArt, and Etsy are full of Star Wars, Star Trek, Muppets, old Disney, and various other art based on old franchises. Teens make gifs and videos, adults make paintings and scarves, everyone makes art and everyone is inspired by the culture that they absorbed as children. Those crayon drawings that no one was ever going to sue over have become hobbies and passions and, sometimes, careers. Careers that can get you in a lot of trouble.

Could these people have been kept away from strongly-protected copyrighted media as children? No. Moreover, I’m not sure one would want to even try that. When they realize, however, the problems inherent in taking inspiration from locked-up culture, it is tempting suggest they simply draw inspiration from elsewhere. There are books, movies, songs, comics, and more either in the Public Domain, or available under Creative Commons licenses. Why not look there? Well, you cannot say to an artist “Oh, just make things with this instead.” That’s not how art works. Art comes from inspiration, and inspiration is not something you can “just swap out”. The issue for these creators is not that they have seen locked-up culture, it is that they have not been exposed to creatively free culture.

So, what can we do?

Give a Child a Story They Can Create With

There are stories and images in the world that are very child-friendly and also provide the creative freedom that will be so important as their desire to create matures. Some great examples include picture books available from Brothers Whim, a cute webcomic called Pepper & Carrot which recently got a printed book funded, and several animated shorts from the Blender Institute, many featuring characters and plots suitable for children.


I am also working in this area, creating a board book for young children using some of the Blender animated characters which you can currently back in crowdfunding.

These works, and others, can be part of the culture a child absorbs while growing up, becoming part of what inspires them later in life. When they find themselves confronted by the dilemma of being inspired by art that our society forbids them to be inspired by, there is a chance they will seize upon other images from their past. Ones they may reuse and remix to their heart’s content.

Christian Faith and Copyfreedom

Posted on

I have for quite some time been involved in the Free Culture and Free Software communities. I have long felt that this affiliation was a natural outgrowth of my faith in Jesus, but I have not written much on this topic.

I believe that a desire to see the world reached for Christ requires that we not restrict the distribution and re-use of Gospel materials, that a desire to control one’s own work must not come before the spiritual needs of worshipers, that a belief in mutual aid is aligned with freedom, and that good stewardship requires a proper evaluations of all options before we spend our God-given resources.

A Desire to Reach the World

My first real encounter with this first issue came when I was in Bible College. For individual use, quotations of the New International Version of the Bible (the most popular English translation) must be no more than 50 verses, and must not be more than 5% of the total of the work in which they appear. This means that handouts or flyers comprised of primarily Bible verses are prohibited. For a church the limits are raised to 500 verses and 25%, but still the issue largely remains. There are various other limitations, including the statement: “This limited license may be revoked and/or modified at any time by Biblica in its sole and absolute discretion.” So at any time, and without warning, my quoted material might no longer be an allowed use!

This bothers me greatly. Do we not want people to read the Bible? Is not the proliferation of the scriptures a primary goal of many Christian organizations? Why would it be right to ban the reproduction or distribution of the scriptures, which are at any rate not the original creative work of the copyright holder, but the inspired word of God! If we truly wish to reach the world, to encourage each other to get out and share the Word with others, then we must be, at very least, allowed to share the Word at all! We should not be asking for “$10,000 + $10/copy distributed” just to distribute the scriptures (citation).

For quite awhile, this issue led me to use only the original text of the King James Version of the Bible. I have since found some other translations that believe that the scriptures should be shared with others, including the excellent World English Bible, but this issue is not only restricted to Bible translations. Many materials of great use in the work of spreading the Gospel are similarly restricted, including: songs, pamphlets, bible story books, curricula, sermons, videos, and much more.

The Spiritual Needs of Worshipers

It has become common practice in Evangelical churches to have special guests who will lead (often musical) worship for a single service. Often these guests will end the worship time with an invitation to “visit their table at the back” to purchase merchandise related to their unique abilities. This is highly reminiscent of a concert where the act sells merchandise to fans as they depart. It is also reminiscent of those events which caused Jesus to say: “Take these things out of here! Don’t make my Father’s house a marketplace!” (John 2:16)

Is it wrong for Christian workers to ask to be compensated for their work? Certainly not. The scripture is full of statements to the contrary. Workers deserve to be compensated for their work. However, no one should capitalize on worship activities. The spiritual needs of God’s people are not a market opportunity to be seized, but a ministry opportunity to be cared for. Many churches pay high licensing fees for the right to publicly display just the lyrics to worship songs during services!

When I was in University, I was a member of a small (under 20 people) InterVarsity chapter. There was a desire amongst the group to join together in musical worship, and so the proper licensing was sought. The cost to display just the lyrics was $60! If we gained just a few more members, the cost would rise to $125! So we sought direct permission from the authors of popular worship songs, thinking that certainly our brothers and sisters in Christ would see this small student group as an opportunity for ministry. Very few did. Notably, the David Crowder Band gave us complete permission to use their songs. Other artists (or, more often, the labels to whom they’ve sold their right) wanted much more money, or were uninterested in dealing with us at all.

There does exist the Open Hymnal Project to group together such hymns as have fallen into the Public Domain, or other worship songs which may be freely used. Sadly, there is very little in the way of so-called “modern” worship music available to be used for worship purposes. Think of that! It is prohibited to use worship music for worship purposes unless you can get explicit permission. Do we not wish for God’s people to worship?

Mutual Aid

Suppose your church has a piece of software to aid in display of lyrics for worship purposes. Simply paste in the song lyrics, select a background, and there you go. You find that at a sister church, someone has to spend hours each week copying and pasting the lyrics to the song set into slide presentation software in order to display it during worship time. Well, you wish to help your sister church, and you have this software, so what is the problem? Give them a copy of the software and all will be well. But if this software is proprietary then giving them a copy is a potential cause of action! So, you are not allowed to help.

Luckily, when I experienced this exact issue I was able to direct our sister church to the excellent freedom-respecting software OpenLP, which they now use happily, but this sort of issue can arise so often. Many churches find their computers are running office software, or even operating systems, that a member simply “loaned” to the church — running the risk of legal action they are not aware of, because the members wanted to help.

This is not just the case with churches helping each other, but also within the body of Christ generally. We are called to the mutual aid one of another. This is much more easily done when the tools we have and produce may be freely shared with each other!

Stewardship

The last point I will touch on in this article is that of stewardship. Often, the reason any given Christian organization goes along with the status quo is simply that it is the status quo. Licenses are paid for music, lyrics, and software; CDs (and books and don’t even get me started on “holy hardware”) are sold; new material produced has its copyright dutifully enforced (or at least no license is given for it); bible quotations are limited (or the limitations ignored, at the risk of legal action); all because it seems to be the way things are done. But does not good stewardship of our resources require that we make the effort to find and evaluate all of our options? If someone is offering us material or tools that are useful to us at a lower cost, should that not be evaluated? Freedom is not always cheaper, but when it is that is certainly a factor.

Should we not so much more seek to help others? Why any church insists on keeping the copyright of its sermon podcast or blog posts is beyond me. These materials are almost wholly produced by volunteers or already-paid staff as a part of their normal function in the church. Should not other believers and other churches benefit from this work that has already been done to further the kingdom? This is why, at least for me, I cannot in good conscience release useful material that it is forbidden to share on reuse. I feel that my faith demands I grant freedom to others.

Free Culture for the Next Generation

Posted on

My life has been going through some transitions recently. My siblings are all married, and one recently had a baby. I got engaged. The sort of changes that get you thinking about the future. The sort of changes that get you thinking about what you want for your kids.

For quite some time now, I’ve been an advocate for digital freedoms, for free culture. I promote libre-licensed music, movies, video games with warzone hack, and books to my friends (and sometimes on the street). Jamendo is filled with pop and rock and metal and electronic music of all varieties. There are movies like Star Wreck and documentaries like RiP. So much work to use, share, and remix.

But when I watch my fiancé’s little cousins or my niece, I see Disney colouring books and wallpapers and toys and t-shirts filling their lives. When I go to shop for my niece, what do I get her? I can get her a stuffed baby GNU, but I quickly run out of options. There is no obvious source for libre characters appearing in colouring pages, activity books, or baby books. The Blender Institute has a few cartoons from which characters could be drawn, but little additional content (since their focus is to promote the Blender software).

It’s not that I think we can somehow fill the next generation’s lives with only libre content based on libre characters, and drive the Disney out. I’m not sure we even really want to do that. But I would like kids to be able to grow up loving at least one set of content that they can build on and be creative with as they grow older. Kids who have as a natural part of the cultural and artistic expression language at least one element they are actually allowed to make use of.

I don’t think I’m alone in this. The free culture movement is filled with parents and aunts and uncles who have probably been thinking about these issues even longer than I have. I cannot change this by myself, nor can a body of work spring up overnight, but I want to get something moving. After a long discussion with a friend, I decided the first thing to try would be a baby board book. In the spirit of free culture (and in the spirit of having a body of related work) I am not creating this book from scratch, but rather basing it on the excellent Big Buck Bunny. I have found a printing company in the USA that does an excellent job of smaller-run board book printing, taught myself all the tricks in Inkscape that I needed in order to produce a draft, and been in contact with Crowd Supply about what I need to get ready for a crowd funding effort.

Artist Renderinghttps://singpolyma.net/wordpress/wp-content/uploads/2015/06/bbbbb-prelaunch-final_png_project-main.jpg 749w, https://singpolyma.net/wordpress/wp-content/uploads/2015/06/bbbbb-prelaunch-final_png_project-main-300x168.jpg 300w" sizes="(max-width: 749px) 100vw, 749px" />

What I need now, is you. The crowd funding has not started yet, but if you are interested in helping this project move forward please register your email address on the prelaunch page. This gives me a much better idea of what sort of volume the final crowd funding (later this year) will be able to get, and gives the project some momentum right from the start (which is very important for any successful crowd funding).

What will the crowd funding include? Well, the full source files (in SVG) and an eBook version of the baby book will be made available to anyone who backs, and afterwards to the whole world if we’re successful, under a Creative Commons Attribution ShareAlike license. The physical printed books themselves (printed in the USA) will be available to backers who pledge enough (final costs still being worked out). Other things (kid-size thirts? stickers?) may also be a part of this, so let me know if you have any really good ideas!

Also, if you are a Facebook user, you can also promote this campaign by sharing/liking the Facebook page.

I have put up a promo video for the book on YouTube and on Archive.org:

Electronic Device Freedom

Posted on

The software freedom movement was born in the 1980s out of a need to champion certain
essential freedoms for computer users:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help your neighbour
  • The freedom to distribute copies of your modified versions to others

These freedoms cover the basic necessities for computer users, but over the years computers have changed, showing us latent ambiguities in this definition. What is “the program”? What is “computing”?

Papering over a binary blob

When the software freedom movement started, a lot of things about computing were simpler. Instructions executing on a CPU would send and receive signals to and from various attached buses in order to initialize and control all of the system’s peripherals. Operating systems needed very specific device drivers for each peripheral that existed on the planet. So “software” was simply everything that contained instructions for the CPU and “computing” was simply the use of “a computer”, which probably seemed pretty clearly defined at the time.

As peripherals grew in number and complexity, there was an increasing need to run some of the instructions that governed their operation on microprocessors other than the CPU. This was done both for performance (so the CPU would not need to be involved for every single bit of WiFi data your antenna sees) and for standardization (so that all storage drives could speak the same language to the host computer). This leads to the question: are these instructions “software”? More specifically, do users of the computer need to have the same freedoms with these instructions as they do with other software in order to have freedom in their computing?

The Free Software Foundation drew the line for “software” at executable instructions that could be altered in a device by the user. The idea is that if the user cannot update the instructions, then they cannot exercise their freedoms even if they were provided them in some theoretical way. These instructions, though made of the same “stuff” as software, are considered a part of the hardware. Of course, this just adds a new question: what does it mean to say “the user can update the instructions”? If they have to desolder and replace a chip, but said replacement chip can be easily had, is that enough?

Discussions around these issues often get lost in the weeds of trying to define the words used in the definition of software freedom published by the FSF. But if the real question is freedom, then the answer lies not in the words, but in the purpose of the words. If “running free software on your computer means that its operation is under your control,” then traditional software freedom is no longer sufficient. Let us examine each freedom in turn.

The freedom to use the device as you wish, for any purpose

Back to an earlier question: what is “computing”? Well, given the context of the software freedom movement, I would argue that “computing” is any context in which the same components as “computers” are used. That is, digital electronics and instructions that command those electronics.

This means that using your TV is a form of “computing”. As is using your mobile phone, your printer, your car, your climate-control system, your health-monitoring band, or your treadmill. These things may not all be what they thought of in the 1980s as “computers”, and they may not even be what we normally think of today as “computers”, but they have the ability to provide or restrict freedom in the same ways as computers, and so I think the same freedoms should be considered in this broad context.

And so, to change the wording slightly of the FSF’s freedom 0: users need the freedom to use their devices as they wish, for any purpose. The fundamental need for this freedom derives from our ideas as a society about personal property. If you own a device, you should be allowed to use that device as you wish, and not only as the creator imagined. You should be free to use your old phone for anything from holding down papers to using its battery to power some new contraption. You should be free to give your old eBook reader to a friend. You should be free to plug your music player into a device that makes it play louder. You should be free to use your DVD player to play home movies and not just Hollywood movies.

The most common violation of this freedom that we fight today is technological protection measures (TPMs), also called digital restrictions, digital locks, digital handcuffs, or DRM. The software freedom movement has been part of the fight against TPMs since they first became a major issue. Your devices may simply refuse to open the movies, music, apps, or books you load onto them. Laws in many countries of the world, intended to protect a few interest groups, make it a criminal offence even to modify your DVD player so it can play some DVDs, your eBook reader to read some eBooks, your phone to run some apps, or your television or digital receiver to have a new video output. This is just one way in which your freedom to use your device as you wish is violated.

The freedom to study how the device works, and change it so it does your computing as you wish

The freedom to change your device is partly about the freedom to use it as you wish. You should be free to use your devices in both ways the creator imagined, and also in new ways. However, if no one is allowed to understand how the device works, or produce ideas for such novel uses, then your freedom to use your device will be limited to uses that are in line with what can be understood about it. What good is being allowed to play home movies on your DVD player if no one knows how to put your home movies onto a DVD?

The smallest part of this freedom is also an expression of your personal property rights. You should be free to open up your devices and look inside. You should be free to send various signals to your device in an attempt to understand how it responds. You should be free to attach new devices to the insides of your device in order to study whatever properties of those insides you wish to study.

So far, these freedoms do not mean that it is the job of the creator to go out of their way to make such things easy. Just as the freedom of the press does not protect reporters from ridicule or war correspondents from bombs, so too the freedom of device modification does not require that update mechanisms be provided. But if you, someone you know, or a new startup company can figure out how to put your device to some new use, they must have the freedom to do so, without fear of successful lawsuit or criminal prosecution.

However, we must go further than that. You need the freedom to study how your devices work, not just to study how they are put together. The fundamental need for this freedom derives from the same source as competition law and consumer protection. Even if you do not intend to study how your device works, you must be free to do so because you need others to be free to do so. If there is a dangerous problem with your device, you should be able to find out. If new devices are to be made, students must be free to study devices that exist.

Imagine mechanics and engineers being trained without being told how existing engines work. Imagine pilots and aerospace engineers being trained without being told how planes are able to fly. Just looking at an airplane is not enough: students must be told how it works. Yet with many devices we use every day, if a student asks how some features of the device work, they might only be told “we don’t know and it is a criminal activity for us to try and find out”.

In order to know how a device works you must know what components are in it and what they do. Many components are not clearly labelled, or their labels come off with time, so it is important to have access to documentation detailing which components were used, and where to find them in the device, or study of these parts of the device may be impossible. Documentation must also exist for each component, detailing what it does. Common components, such as resistors or transistors, are readily documented in general knowledge, and so simply saying “this is a 5 ohm resistor” may be sufficient. Integrated circuits may need a bit more explanation, such as “this flash memory can be communicated with according to such-and-such a protocol”. For circuits that can be reprogrammed, such as microprocessors, you need access to the source code that creates the instructions running on those circuits. For circuits composed of multiple devices (such as a System on Chip) you need to know what devices are present, and how to communicate with each one.

Note that even here there are levels of depth. If I know that a device uses a particular system on chip, what capabilities that system on chip has, and have the source form of the instructions that run on that system on chip, then I can understand how my device works. I may not understand how another device that I own (namely, the system on chip itself) works, but I know how the device it is embedded within works. And so we have devices within devices, possibly further nested than this. Really we do need the freedom to study how all our devices work. However, if our freedom is restricted on one device that might not necessarily restrict our freedoms with respect to devices made out of that device.

Some creators violate these rights by intentionally obscuring what components they have used. Sometimes laws exist to prevent anyone from studying some components directly (for example, in many countries it would be criminal activity to discover how a DVD player’s TPMs work, even though we already know). However, the largest way in which these rights are violated is by omission: creators simply do not tell us what components they have used or what instructions they have given to those components, and so we have no effective way of finding out how the device works at all.

The freedom to tell others how your device works so you can help your neighbour

Not everyone has the time or resources to study how their devices work. If everyone had the freedom to study in this way, but could not share what they had learned, then what have we gained? And so it is important that you be free to share what you have learned with others, and to tell others what instructions are running on the microprocessor or what the use of some particular combination of components is.

The most common way in which this freedom is violated is by the use of copyright law or non-disclosure agreements to restrict the redistribution of source code, specifications, or schematics.

The freedom to create new devices based on your existing devices, and to distribute these new devices

I once asked Richard Stallman, a key leader of the software freedom movement, why he doesn’t propose that freedom should be extended to the hardware level in our devices. He replied that he doesn’t need that freedom because he doesn’t have a fabrication line. This line of reasoning is, I expect, also what lead the Free Software Foundation to classify freedom for microprocessor instructions that a user cannot update as non-essential. The idea is, if you cannot make the change, then what good is your freedom to make that change doing you?

I would suggest that the change can always be made, but you may not be able to make it alone. It is getting easier and easier for smaller groups to get electronics of various kinds fabricated. I may not be able to update the firmware on my keyboard, but I could (if someone makes one, which they should have the freedom to do) order a replacement controller and have someone install it for me. I may not be able to update the software on my car’s multimedia system, but I could pay someone to install a new multimedia system in my car. I may not be able to add new instructions to my car’s fuel injection system, but I can install an aftermarket controller in an attempt to boost my fuel efficiency.

So it is that you need not only the freedom to study existing devices, so that you know how they work, but the freedom to make new devices, so that everyone can benefit. The key ways in which this freedom is violated today are both copyright and patent laws, preventing new devices from being made that reuse either parts of the software or techniques of previous devices.

Limitations on Freedom

I have up to this point talked about freedom as an absolute, but of course it is not. In the same way that your freedom of speech does not prevent libel lawsuits or protect your hate speech, so should your electronic freedom not be without limit. While you need to be free to use your device as you wish, if you use it to criminal ends you may still be prosecuted as a criminal. When you are granted the freedom to study or alter your device, it must be without specific restriction, but other restrictions may reasonably be placed on you by lawmakers according to the governance of your society.

Partial freedom

We do not yet live in a world where every computing-related device one might need to use, or every computing-related goal one might need to acheive, can be achieved in perfect freedom. That is, of course, our goal, and an important part of reaching that goal is to make use wherever possible of the freedom that we do have. However, sometimes one must make a very difficult choice.

If you value freedom, you may desire a laptop whose CPU you can study and modify. However, no effective laptop of this nature currently exists. So there is a choice: use a laptop that disrespects some of your essential freedoms, or do not use a laptop at all. However, the choice is hardly a binary one. You may chose a laptop which can be operated entirely using instructions to the CPU and peripherals that can be studied. This is certainly a huge improvement over a laptop where nothing can be studied, even if it is not ideal!

Even the GNU project, the flagship software freedom project of the FreeSoftware Foundation, was initially developed using software that did notprovide the members of the GNU project with freedom. Why? Becausefreedom-respecting tools did not yet exist — they were in the midst of creating them!

You will never have freedom if you wait for the perfect ideal before you begin to prefer tools that respect your freedom. However, you will also never have freedom if you do not carefully consider the implications of devices and programs you choose. The question that is always before you is: are you compromising your freedom out of necessity, or because of a lack of knowledge of motivation? Take your own freedom, and the freedom of your neighbour, seriously.

Innovation

We will never achieve the freedom we desire if we content ourselves with fighting for the freedom of devices we already know about. This is the sort of strategy that led to freedom existing only for desktop computers, and then for desktops and laptops, and losing (without even knowing it was happening) the battle for keyboards, mice, touchscreens, cellular data modems, and so many other peripherals. If we only work to free what exists, then we will miss out on every new thing that might exist, and many users will be tempted away from freedom by new devices.

So what am I saying we must anticipate every possible new device? Should we have anticipated projected capacitive touch technology and the Thalmic Myo and the health monitoring arm-bands and smart-watches and every other thing? Of course not, that would be impossible. Rather, we should: convince more people to care about their freedom enough so that new innovators care to think to give it to them, and we should work on new innovations ourselves, and not be content to simply copy what we see around us in our work for freedom.

What am I going to do about it?

I have been a software freedom advocate for some time now, and have worked on such issues as freedom for interactive websites and freedom in the social networking space. The work is not yet done in these areas, though great progress has been made. I, however, plan to shift my focus in 2015 down a few layers to the devices we use themselves. I have already been supporting amazing devices that greatly (if not completely) respect users’ freedom, such as:

  • Novena, a motherboard, battery control board, and laptop for hardware research, prototyping, and creation
  • Gluglug Laptops, refurbished laptops that respect your freedom in every aspect of the software
  • USB Armory, a freedom-respecting USB-powered computer for security applications
  • ZaReason Computers — most of their devices respect user freedom in all instruction executing on the CPU

And there are other devices which might be of interest as well, including the GCW Zero, a handheld gaming console, and FSF endorsed devices.

On the new work front, I am tackling the tablet and netbook space. Hardly the most innovative space, I agree, but this will give me experience with whole-device creation as well as touch-panel technology that I think will be useful in the creation of many possible future devices. My goals for the near future are the following:

  1. Source and install a PCAP panel for my Novena when it arrives, and have this working as a pseudo-tablet by sometime in the spring
  2. By the end of 2015, have a prototype tablet built out of a readily-available single-board computer that anyone with access to a makerspace could replicate
  3. Do the work to turn this prototype into an acceptable tablet form-factor

After this point, a tablet that respects user freedom in every instruction executing on a microprocessor (except the PCAP controller) should be possible. So all that will remain for the tablet itself is to create a liberated PCAP controller that will work with easily-obtained microprocessors. This may involve reverse-engineering touch panels to some degree, and will definitely involve complex finger-tracking algorithm development for multitouch.

This is not a short-term project, and I’m not going to quit my day job, so it is likely that needs (and my abilities) will change eventually, resulting in new directions, but for the next chunk of time, this will be my priority.

What are you going to do about it?

You, too, can do your part for freedom. If you are a software developer (like me) you can create new innovative software that respects freedom or contribute to existing software freedom projects. If you are a hardware hacker, you too can work on devices where there is need. If you have money you can help fund important projects and organizations. If you have a small community with software or device-related needs, you can tell people about those needs. Freedom means the freedom to have your needs met (though you may need to find someone with the skills to make the necessary improvements), and not be forced to wait until some big company decides there is a market for the features you desire. Get out there and use the freedom-respecting technology that exists, figure out what is wrong with it, talk about it, tell people in the community where things can be improved. We have come a long way since the 1980s, but there is so much more to do, and everyone can be a part of it.

Why is That Value False?

Posted on

This post is a response to Boolean Externalities, so you should probably read that first.

The core of this problem is a lack of combinators. In order to propogate the reason why something is falsy, you need to add a lot of logic to each method, which noises up the code considerably.

So we start with a pseudo-falsy base class for all our possible “reasons”:

class WhyFalsy
	# This is so you can convert to bool with !!
	def !@
		true
	end

	def blank?
		true
	end
end

Now we can make objects that represent particular reasons, like:

class NoConfirmedAt < WhyFalsy; end

And use them in conditionals with only a little syntax pain:

!!NoConfirmedAt.new ? "confirmed at" : "not"

Now that we have these objects, we can create methods that let us combine them without throwing away the information we care about:

class WhyFalsy
	def or
		yield
	end

	def and
		self
	end
end

class Object
	def or
		self
	end

	def and
		yield
	end
end

class FalseClass
	def or
		yield
	end

	def and
		self
	end
end

class NilClass
	def or
		yield
	end

	def and
		self
	end
end

The normal && and || operators cannot be overloaded, so we define our own very similar methods, which allow us to write code like this:

def fully_authenticated?
	authenticated_accounts?.and { verified_email? }
end

Where any pseudo-falsy reason value we bubble up will be treated the same as the actual false or nil, and any other value will be treated truthily, same as before.

What if we want to wrap the result of some existing API (or DB column) in a reason? That’s a pretty easy smart constructor:

class WhyFalsy
	def self.wrap(x)
		# The !! makes fake-falsy values (like us) work
		!!x ? x : self.new
	end
end

Now we can easily wrap any existing API:

NotFree.wrap(free?)

Developers are lazy, and especially if they’re just using this in debugging they just want to use English text, like so:

class WhyFalsy
	attr_reader :msg

	def initialize(msg=nil)
		@msg = msg
	end
end

And while all these ways to know why something is falsy are nice, it would be even nicer if we could know *where* the falsy value came from:

class WhyFalsy
	attr_reader :msg, :backtrace

	def initialize(msg=nil)
		@msg = msg

		# Hack to get a backtrace
		begin
			raise
		rescue Exception
			@backtrace = $!.backtrace
			@backtrace.shift # Remove the reference to initialize
		end
	end
end

And there you have it, a complete, workable solution for propogating the information we care about all the way up to our call site.

Haskellers might recognize that this is basically a very-Rubyified encoding of the following:

import Control.Applicative
import Data.Monoid

instance (Monoid r) => (Either r) where
	empty = Left empty
	Left _ <|> x = x
	     x <|> _  = x

wrap True _    = Right ()
wrap False msg = Left msg

fully_authenticated = authenticated_accounts *> verified_email
available_to_user = free <|> (current_subscriber user)

The full code from this post is available as a gist.