digitalmars.D - Interesting article and discussion about Python's standard library
- Andrei Alexandrescu (1/1) May 18 2019 https://news.ycombinator.com/item?id=19948642
- ikod (11/17) May 18 2019 Actually I see no problem here. I'm using python as everyday
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (28/34) May 19 2019 Yup, seems like people somehow forgets what a scripting language
- Francis Locke (8/11) May 19 2019 I don't know about Go, but I use D for "scripting," a lot. (Go
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (26/33) May 19 2019 Yes, I remember I was amazed that a compiled language could be
- Russel Winder (36/37) May 19 2019 I'd say Amber Brown is right, the Python standard library needs strippin...
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (14/16) May 19 2019 I don't think Python should not follow suit. It is in a different
- Jacob Carlborg (5/11) May 19 2019 How about a new command for Dub that allows it to work like a package
- sarn (15/17) May 19 2019 In *nix land, there's the foo-config idiom, i.e., a command that
- Walter Bright (6/7) May 19 2019 Unfortunately, there's no clear answer to this problem.
- Atila Neves (5/6) May 21 2019 Thanks for sharing. I think the hacker news comments were nearly
- David Gileadi (4/12) May 21 2019 Multiple coexisting versions is an interesting way of solving dependency...
- Nick Sabalausky (Abscissa) (9/19) May 21 2019 In terms of multiple simultaneously *installed* versions, I consider it
- H. S. Teoh (15/36) May 21 2019 This is a very interesting idea indeed. Goes along well with Andrei's
- Johannes Pfau (11/27) May 21 2019 Having multiple versions of libraries only works well though if there ar...
- sarn (5/8) May 21 2019 In the JavaScript world, npm doesn't have that problem because it
- Nick Sabalausky (Abscissa) (2/11) May 21 2019 Wow, that actually explains quite a lot about the modern web.
- Paolo Invernizzi (5/13) May 22 2019 And that's why a simple vue.js project on my machine gives a
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (14/17) May 22 2019 Plain npm usage does not seem to pull in two versions of the
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (15/17) May 22 2019 npm allows you to specify a semver range, so if the range does
- John Colvin (4/20) May 22 2019 Also, type versioning. Types from different versions would have
- H. S. Teoh (10/31) May 22 2019 It doesn't break, because symbols in D are qualified by module name. So
https://news.ycombinator.com/item?id=19948642
May 18 2019
On Sunday, 19 May 2019 at 03:33:15 UTC, Andrei Alexandrescu wrote:https://news.ycombinator.com/item?id=19948642Brown asserted that there were many such dependencies from the standard library to PyPI: typing works best with mypy, the ssl module requires a monkeypatch to connect to non-ASCII domain names, datetime needs pytz, and six is non-optional for writing code for Python 2 and 3.Actually I see no problem here. I'm using python as everyday tool, and yes, there is lot of packages in Pypi repo that are more user-friendly or more complete than standard library modules, but not every pypi module works on every platform where python library works and not always compatible with every python version (and this sometimes is real PITA). Her point is to move some parts of standard library to PyPI, but I'm not sure if this is good. The real point should be to get better support for modules regardless of their location - std library or PyPI.
May 18 2019
On Sunday, 19 May 2019 at 04:10:22 UTC, ikod wrote:Actually I see no problem here. I'm using python as everyday tool, and yes, there is lot of packages in Pypi repo that are more user-friendly or more complete than standard library modules, but not every pypi module works on every platform where python library works and not always compatible with every python version (and this sometimes is real PITA).Yup, seems like people somehow forgets what a scripting language traditionally has been used for as they now also increasingly are used for applications. The libs that have been outdated the most is the HTTP/Web ones, and that is absolutely crucial as a builtin for a useful scripting language. Anyway, with the standard lib I can just install the default Python build and set up a script to set up daily transfer of stuff from some old windows server to the cloud. All I need is MSIE+notepad. Cost saving efficiency, even despite having to do some workarounds. Get it done same day on a an outdated nothing-installed server with no hickups. Solving boring tasks like these on time is what has made Perl, Python, bash/unix popular. Actually, I've found it bothersome and time consuming that the std lib lacked key crypto algorithms. I've also had to improvise my own encoding for HTTP POST on site. So, no, the Python 2 library was not too big at all, it was quite deficient in terms of features. Anyway, Python is a scripting language often used for hashing out solutions on-site at a break-neck pace (near real time). Python should ship configured as a swiss armyknife and then some. As long as weaknesses are documented in the Python docs, then it is ok that some of it is imperfect. I'd rather have a leaky firehose when the house is burning than none at all! D and Go are not scripting languages! Scripting languages need builtins that enable fast deployment and quick fixes.
May 19 2019
On Sunday, 19 May 2019 at 13:39:04 UTC, Ola Fosheim Grøstad wrote:On Sunday, 19 May 2019 at 04:10:22 UTC, ikod wrote: D and Go are not scripting languages! Scripting languages need builtins that enable fast deployment and quick fixes.I don't know about Go, but I use D for "scripting," a lot. (Go rdmd!) Both D and Python can be described as general-purpose languages. (Hell, D's landing page advertises it as such.) And a good general-purpose language, for me, is one that gives a nice, stable stdlib that allows you to build your initial solution without having to worry about dependencies. In fact, I wish D's stdlib was bigger! Ms. Brown has ostensibly lost sight of this.
May 19 2019
On Sunday, 19 May 2019 at 18:54:03 UTC, Francis Locke wrote:I don't know about Go, but I use D for "scripting," a lot. (Go rdmd!)Yes, I remember I was amazed that a compiled language could be used like that the first time it was introduced. :-) I view D more as a language that originated with aspirations towards systems-programming then ended up with more emphasis towards application programming and bends the limits towards scripting (or prototyping). Whereas I view Python primarily as a scripting language ("real time" patch-things-together coding) that has bent the limits towards application development.And a good general-purpose language, for me, is one that gives a nice, stable stdlib that allows you to build your initial solution without having to worry about dependencies. In fact, I wish D's stdlib was bigger! Ms. Brown has ostensibly lost sight of this.Got ya. :-) I guess there are three contradicting views: 1. For a low level system programming language then you want a small runtime and small library that is easy to port and that makes it possible to reuse other libraries without too much bloat (so all third party libraries only depend on a limited standard library). 2. For scripting and high level programming you want the exact opposite. You want a large coherent standard library that provides a shared set of concepts and names for constructs that becomes a shared language between programmers (e.g. ranges in D stdlib). 3. For system level application development you want a standard library that complement the native operating system you target in a very clean and coherent fashion. And provides access to the specific features of the OS (like subscribing to file directory changes, GPS location and what not).
May 19 2019
On Sat, 2019-05-18 at 23:33 -0400, Andrei Alexandrescu via Digitalmars-d wrote:https://news.ycombinator.com/item?id=3D19948642I'd say Amber Brown is right, the Python standard library needs stripping b= ack quite a lot and stuff moved to PyPI. Or pip-able using Git,Mercurial, Breez= y, etc. directly so as to access packages not in PyPI. Go and Rust have both gone with the small standard library and strong suppo= rt for bringing in dependencies. Go only uses DVCS mechanisms, shunning a cent= ral repository of packages. For me this is wrong. Rust has gone with support fo= r a central repository and DVCS. I find this the right route. D has a central library but no support for DVCS for getting dependencies in Dub. This should be fixed.=20 I failed to do anything about it at the D hack day, but what I think is nee= ded is a library separate from Dub (or perhaps split off from Dub that Dub then uses) for accessing the central D library. This will then allow Meson, SCon= s, etc. to better support working with the central D repository and used DVCS = to access packages. This should then make adding DVCS support relatively straightforward. With this in place Phobos can then be stripped back to only that that is absolutely needed. Rust is a really good model here. Python, Go, and D should follow suit. =20 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
May 19 2019
On Sunday, 19 May 2019 at 11:48:44 UTC, Russel Winder wrote:Rust is a really good model here. Python, Go, and D should follow suit.I don't think Python should not follow suit. It is in a different league. I can trust the standard library to not contain malicious code. Buggy code is far less problematic than the possibility of facing trojans. If I use code from a third party I will have to read and vet every single line of code to ensure that there is no backdoor. So that limit me to very short code segments. I've done it for crypto code. I'd rather not do it. I'd rather use imperfect standard library code. You want code that has had many eyes on it and where the flaws are well documented when you install scripts behind firewalls of commercial entities.
May 19 2019
On 2019-05-19 13:48, Russel Winder wrote:I failed to do anything about it at the D hack day, but what I think is needed is a library separate from Dub (or perhaps split off from Dub that Dub then uses) for accessing the central D library. This will then allow Meson, SCons, etc. to better support working with the central D repository and used DVCS to access packages. This should then make adding DVCS support relatively straightforward.How about a new command for Dub that allows it to work like a package manager without the building stuff? -- /Jacob Carlborg
May 19 2019
On Sunday, 19 May 2019 at 19:08:27 UTC, Jacob Carlborg wrote:How about a new command for Dub that allows it to work like a package manager without the building stuff?In *nix land, there's the foo-config idiom, i.e., a command that gives you the flags needed to compile something with foo. For example, sdl-config: $ sdl-config --libs -lSDL -lpthread $ sdl-config --cflags -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT Typical usage: $ gcc $(sdl-config --cflags) --other --flags -c thing_using_sdl.c It's useful because it works with any build system. In the past I've used dummy projects containing nothing but a dub.json, and parsed the output of dub describe. But I've only made an 80% solution, not something good enough to release as an official tool.
May 19 2019
On 5/18/2019 8:33 PM, Andrei Alexandrescu wrote:https://news.ycombinator.com/item?id=19948642Unfortunately, there's no clear answer to this problem. One issue not mentioned - while it shouldn't be, Phobos is an essential part of the compiler test suite. 1. the compiler test suite is inadequate 2. breaking Phobos is a good predictor of what will break in user code
May 19 2019
On Sunday, 19 May 2019 at 03:33:15 UTC, Andrei Alexandrescu wrote:https://news.ycombinator.com/item?id=19948642Thanks for sharing. I think the hacker news comments were nearly as interesting as the article itself. It's a hard problem figuring out what should go in the standard library or not and there's probably n one right answer.
May 21 2019
On 5/21/19 2:14 AM, Atila Neves wrote:On Sunday, 19 May 2019 at 03:33:15 UTC, Andrei Alexandrescu wrote:I didn't know this about Rust, so I found the following comment interesting:https://news.ycombinator.com/item?id=19948642Thanks for sharing. I think the hacker news comments were nearly as interesting as the article itself. It's a hard problem figuring out what should go in the standard library or not and there's probably n one right answer.For example, the libstd doesn't even have support for random number generation. There's a rand crate, which is now on 6th major breaking version. That's perfectly fine, because multiple versions can coexist in one program, and every user can upgrade (or not) at their own pace. And the crate was able to refine its interface six times, instead of being stuck with the first try forever.Multiple coexisting versions is an interesting way of solving dependency hell.
May 21 2019
On 5/21/19 11:15 AM, David Gileadi wrote:On 5/21/19 2:14 AM, Atila Neves wrote:In terms of multiple simultaneously *installed* versions, I consider it an absolutely essential feature of any *good* package manager (This is a big part of why I hate most system-level Linux package managers, including the one on my own machine). But the idea of multiple versions *within one program* is indeed interesting. Doesn't strike me as something you'd want to frequently take advantage of, but having it there as a viable workaround for when problems do arise could certainly be quite nice.For example, the libstd doesn't even have support for random number generation. There's a rand crate, which is now on 6th major breaking version. That's perfectly fine, because multiple versions can coexist in one program, and every user can upgrade (or not) at their own pace. And the crate was able to refine its interface six times, instead of being stuck with the first try forever.Multiple coexisting versions is an interesting way of solving dependency hell.
May 21 2019
On Tue, May 21, 2019 at 12:29:55PM -0400, Nick Sabalausky (Abscissa) via Digitalmars-d wrote:On 5/21/19 11:15 AM, David Gileadi wrote:This is a very interesting idea indeed. Goes along well with Andrei's recent idea of addition vs. replacement. And I think it's probably not hard to adopt in D (should we deem it a good idea -- that's still arguable): all you need is for module declarations to come with an attached version number, then include that in the mangling. This automatically gives a unique identifier to symbols in the module, so you could import multiple versions of the same module and have the symbols resolve correctly. Just a minor change in module declarations and in module name mangling. Of course, how to handle imports that may have multiple satisfying versions is another, stickier, question. T -- Meat: euphemism for dead animal. -- FloraOn 5/21/19 2:14 AM, Atila Neves wrote:In terms of multiple simultaneously *installed* versions, I consider it an absolutely essential feature of any *good* package manager (This is a big part of why I hate most system-level Linux package managers, including the one on my own machine). But the idea of multiple versions *within one program* is indeed interesting. Doesn't strike me as something you'd want to frequently take advantage of, but having it there as a viable workaround for when problems do arise could certainly be quite nice.For example, the libstd doesn't even have support for random number generation. There's a rand crate, which is now on 6th major breaking version. That's perfectly fine, because multiple versions can coexist in one program, and every user can upgrade (or not) at their own pace. And the crate was able to refine its interface six times, instead of being stuck with the first try forever.Multiple coexisting versions is an interesting way of solving dependency hell.
May 21 2019
Am Tue, 21 May 2019 09:39:29 -0700 schrieb H. S. Teoh:On Tue, May 21, 2019 at 12:29:55PM -0400, Nick Sabalausky (Abscissa) viaHaving multiple versions of libraries only works well though if there are no dependency cycles between third party modules. Random has a very 'closed' API, so for that it works well. As another extreme example, consider we have six different versions for std.range. Then we have std.file which provides a v1 range, std.format which only formats v3 ranges, vibe.d which still uses v2 and your applications which want's to combine all these and pass ranges from std.file to vibe.d and std.format. -- JohannesIn terms of multiple simultaneously *installed* versions, I consider it an absolutely essential feature of any *good* package manager (This is a big part of why I hate most system-level Linux package managers, including the one on my own machine). But the idea of multiple versions *within one program* is indeed interesting. Doesn't strike me as something you'd want to frequently take advantage of, but having it there as a viable workaround for when problems do arise could certainly be quite nice.This is a very interesting idea indeed. Goes along well with Andrei's recent idea of addition vs. replacement. And I think it's probably not hard to adopt in D (should we deem it a good idea -- that's still arguable):
May 21 2019
On Tuesday, 21 May 2019 at 18:06:44 UTC, Johannes Pfau wrote:Having multiple versions of libraries only works well though if there are no dependency cycles between third party modules. Random has a very 'closed' API, so for that it works well.In the JavaScript world, npm doesn't have that problem because it gives each dependency its own dependency tree. (If D tried that, the ABI compatibility issues would be painful, and the embedded developers would weep at the bloat.)
May 21 2019
On 5/21/19 6:30 PM, sarn wrote:On Tuesday, 21 May 2019 at 18:06:44 UTC, Johannes Pfau wrote:Wow, that actually explains quite a lot about the modern web.Having multiple versions of libraries only works well though if there are no dependency cycles between third party modules. Random has a very 'closed' API, so for that it works well.In the JavaScript world, npm doesn't have that problem because it gives each dependency its own dependency tree. (If D tried that, the ABI compatibility issues would be painful, and the embedded developers would weep at the bloat.)
May 21 2019
On Tuesday, 21 May 2019 at 22:30:17 UTC, sarn wrote:On Tuesday, 21 May 2019 at 18:06:44 UTC, Johannes Pfau wrote:And that's why a simple vue.js project on my machine gives a node_modules directory that's crowded as a termite mound ... Please no ... /PHaving multiple versions of libraries only works well though if there are no dependency cycles between third party modules. Random has a very 'closed' API, so for that it works well.In the JavaScript world, npm doesn't have that problem because it gives each dependency its own dependency tree. (If D tried that, the ABI compatibility issues would be painful, and the embedded developers would weep at the bloat.)
May 22 2019
On Wednesday, 22 May 2019 at 08:00:15 UTC, Paolo Invernizzi wrote:And that's why a simple vue.js project on my machine gives a node_modules directory that's crowded as a termite mound ... Please no ...Plain npm usage does not seem to pull in two versions of the same library. What is common is to have one module for a single function. That's what the directory bloat comes from. So node_modules look more crowded than it actually is. A lot of those functions belong in a standard library though. For instance Angular pulls in: nice-try: call a function and discard exceptions once: throw an error if the function is called twice onetime: a function returns a cached value if called many times extend: merge two objects extend-shallow: merge in properties from other object And so on…
May 22 2019
On Wednesday, 22 May 2019 at 09:16:28 UTC, Ola Fosheim Grøstad wrote:Plain npm usage does not seem to pull in two versions of the same library.npm allows you to specify a semver range, so if the range does not overlap then it will pull in a "duplicate". Although for libraries that are exposed externally (like react), you can specify that it is a peer dependency that should only exists as one semver version. In which case it should complain. At least, that is my shallow understanding of the system. Allowing version 1 and 2 of a library to coexist in the same build is no different than depending on two independent libraries that provides the same functionality under different names. Makes sense to allow a build to succeed if two modules depends on two different versions of some simple set of functions. Especially in a culture where there tends to be one function per module.
May 22 2019
On Tuesday, 21 May 2019 at 16:39:29 UTC, H. S. Teoh wrote:On Tue, May 21, 2019 at 12:29:55PM -0400, Nick Sabalausky (Abscissa) via Digitalmars-d wrote:Also, type versioning. Types from different versions would have to be completely separate, which would break function signatures, overloads, introspection etc.[...]This is a very interesting idea indeed. Goes along well with Andrei's recent idea of addition vs. replacement. And I think it's probably not hard to adopt in D (should we deem it a good idea -- that's still arguable): all you need is for module declarations to come with an attached version number, then include that in the mangling. This automatically gives a unique identifier to symbols in the module, so you could import multiple versions of the same module and have the symbols resolve correctly. Just a minor change in module declarations and in module name mangling. Of course, how to handle imports that may have multiple satisfying versions is another, stickier, question. T
May 22 2019
On Wed, May 22, 2019 at 10:55:09AM +0000, John Colvin via Digitalmars-d wrote:On Tuesday, 21 May 2019 at 16:39:29 UTC, H. S. Teoh wrote:[...]On Tue, May 21, 2019 at 12:29:55PM -0400, Nick Sabalausky (Abscissa) via Digitalmars-d wrote:[...]This is a very interesting idea indeed. Goes along well with Andrei's recent idea of addition vs. replacement. And I think it's probably not hard to adopt in D (should we deem it a good idea -- that's still arguable): all you need is for module declarations to come with an attached version number, then include that in the mangling. This automatically gives a unique identifier to symbols in the module, so you could import multiple versions of the same module and have the symbols resolve correctly. Just a minor change in module declarations and in module name mangling. Of course, how to handle imports that may have multiple satisfying versions is another, stickier, question.Also, type versioning. Types from different versions would have to be completely separate, which would break function signatures, overloads, introspection etc.It doesn't break, because symbols in D are qualified by module name. So if the module name contains version information, types from different versions will be differently-named. For example, moduleA.ver1_0.myStruct will be distinct from moduleA.ver2_0.myStruct, so you couldn't mix the two together unintentionally without a compile error. T -- If it breaks, you get to keep both pieces. -- Software disclaimer notice
May 22 2019