Should I write a TCP/IP stack in 2016, I would do it IPv6 only. There are several methods for translating IPv4 into IPv6 so that you can get both protocols working anyway. Writing it IPv4 only is useless and harder to extend later.
And don't come to tell me that we are not using IPv6 please... ( https://www.google.com/intl/en/ipv6/statistics.html )
[Edit: link]
You obviously need edge devices that translate for you, e.g. using NAT64 (which maps IPv4 to a /96 IPv6 subnet. Since you then have an IPv6 address for each IPv4 address, you don't even need to maintain state on the gateway, so it scales very well)