Assignment versus binding

Chris Angelico rosuav at gmail.com
Wed Oct 5 19:27:38 EDT 2016


On Thu, Oct 6, 2016 at 9:45 AM, BartC <bc at freeuk.com> wrote:
> On 05/10/2016 22:34, Chris Angelico wrote:
>>
>> On Thu, Oct 6, 2016 at 6:35 AM, BartC <bc at freeuk.com> wrote:
>>>
>>> This is exactly why I persist with my own language implementations. My
>>> current one is only 1/5000th the size but standard libraries are
>>> included!)
>>
>>
>> Yes, it has all the standard library that *you* expect. Does it have
>> what some random person on the internet will expect? Here are a few
>> examples from the standard library of Python:
>>
>> * Unicode character names and categories
>> * Date/time manipulation
>> * Arbitrary-precision rationals
>> * Statistical functions
>> * zlib (zip/gzip) compression and decompression
>> * sqlite3 databasing
>> * BSD sockets
>> * Various internet protocols  (HTTP, FTP, SMTP, IMAP)
>>
>> And that's not even counting the stuff that, if it were proposed
>> today, would probably be pushed to PyPI. Standard libraries tend to be
>> fairly large because they're catering to a lot of people's needs. Mind
>> you, two gig is still a lot, I'm not denying that; but you're saying
>> that yours is half a meg, and I doubt that a full-featured language of
>> today can exist inside a floppy disk.
>
>
> No, it doesn't have all that. But believe me, even with all those things,
> and even if it worked, a 2GB language implementation is *MASSIVE*, not just
> a lot.

Yeah - I agreed with you on that. 2GB+ is huge. But if you try to keep
your language ubertiny, you're going to have a _lot_ of people
complaining that your stdlib doesn't have <X>.

> Even Python, not exactly small, is only 2.5% the size (for 3.4 and
> presumably including all the libraries in your list).

Right. I didn't calculate the percentages, but my cpython/Lib
directory is something like 40MB. You could shrink that down a ton by
eliminating the tests and zipping the rest up, without losing primary
functionality, but it'd still be a good solid bit - about 5MB.

> As to what it consists of, well it doesn't include any How-To videos which
> would account for much of it. But it does seem to have MSYS (ie. half a Unix
> system, 200MB); Mingw (a gcc C compiler, 350MB); docs (180MB); and a library
> (1300MB, but looking at it much of it seems to be useless junk).
>
>> (Also, does your implementation compile directly to machine code, or
>> does it depend on something else? It's easy to make something small if
>> it depends on another compiler/interpreter.)
>
> The language in question is interpreted. It depends on a
> compiler/interpreter which is currently a 300KB executable but could end up
> a bit bigger. The most basic libraries are another 60KB (which will probably
> end up inside the executable). The only dependencies are what is already
> present in an OS (msvcrt.dll for example).

Ignoring OS-provided deps is perfectly fine. But if, for instance,
your program emits C code, then it depends on a C compiler, which adds
to the effective download.

> Small languages are perfectly viable: the JIT version of Lua, for example,
> is only about 225KB, and is very fast.
>
> If I wanted to send you program.lua, and you didn't have Lua, I only need to
> add luajit.exe and lus51.dll (for Windows). With my system, it would be
> program.q and r.exe, even for multi-module apps.

See above about how restricted the stdib is. Lua, on its own, is not a
full-featured language for writing general-purpose applications. It's
designed to be embedded in something else, and it's great at that, but
it doesn't have all the features of a modern apps language. You could
write an Ook interpreter in a handful of bytes of code, but it's not
what you would write an app in. Since you're talking about Windows, I
grabbed file sizes for Windows installers; for Pike, the .msi file is
a 24MB download, and Python clocks in variously at 18MB (32-bit
2.7.12) up to 28MB (64-bit 3.5.2 full installation). Those kinds of
figures are pretty reasonable for full-featured language interpreters.
You get enough for it to actually be usable as-is, but you're not
getting a full C dev environment.

ChrisA



More information about the Python-list mailing list