www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is std.process.browse a category mistake?

reply kdevel <kdevel vogtner.de> writes:
https://dlang.org/phobos/std_process.html#browse

    void browse(scope const(char)[] url);
       Start up the browser and set it to viewing the page at url.

It feels wrong that this function is in std.process.
May 27 2022
next sibling parent reply Adam Ruppe <destructionator gmail.com> writes:
On Friday, 27 May 2022 at 18:46:36 UTC, kdevel wrote:
 It feels wrong that this function is in std.process.
Why? It does spawn a process, after all...
May 27 2022
parent reply kdevel <kdevel vogtner.de> writes:
On Friday, 27 May 2022 at 19:05:15 UTC, Adam Ruppe wrote:
 On Friday, 27 May 2022 at 18:46:36 UTC, kdevel wrote:
 It feels wrong that this function is in std.process.
Why? It does spawn a process, after all...
The same applies to std.process.water_the_flowers.
May 27 2022
parent reply Adam D Ruppe <destructionator gmail.com> writes:
On Friday, 27 May 2022 at 19:14:33 UTC, kdevel wrote:
 The same applies to std.process.water_the_flowers.
and it should really be there. On Windows, there's a function to just open any file in the user's preferred application. (That's actually the one `browse` calls.) It is kinda useful to have.
May 27 2022
parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, May 27, 2022 at 07:36:38PM +0000, Adam D Ruppe via Digitalmars-d wrote:
 On Friday, 27 May 2022 at 19:14:33 UTC, kdevel wrote:
 The same applies to std.process.water_the_flowers.
and it should really be there. On Windows, there's a function to just open any file in the user's preferred application. (That's actually the one `browse` calls.) It is kinda useful to have.
On (some flavors/configurations of) Linux there's `xdg-open` that does pretty much the same thing. If installed, that is. Minimal setups may not include this utility. Nonetheless, it may be a convenient thing to have, who knows. ... and in fact, xdg-open is what std.process.browse calls, if it exists. If $BROWSER is set, that gets used in preference over xdg-open. But if $BROWSER isn't set, xdg-open is used as a fallback. T -- MAS = Mana Ada Sistem?
May 27 2022
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, May 27, 2022 at 06:46:36PM +0000, kdevel via Digitalmars-d wrote:
 https://dlang.org/phobos/std_process.html#browse
 
    void browse(scope const(char)[] url);
       Start up the browser and set it to viewing the page at url.
 
 It feels wrong that this function is in std.process.
Where would be a better place for it? T -- Bomb technician: If I'm running, try to keep up.
May 27 2022
parent reply kdevel <kdevel vogtner.de> writes:
On Friday, 27 May 2022 at 19:10:59 UTC, H. S. Teoh wrote:
 On Fri, May 27, 2022 at 06:46:36PM +0000, kdevel via 
 Digitalmars-d wrote:
 https://dlang.org/phobos/std_process.html#browse
 
    void browse(scope const(char)[] url);
       Start up the browser and set it to viewing the page at 
 url.
 
 It feels wrong that this function is in std.process.
Where would be a better place for it?
In std.useragents?
May 27 2022
parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, May 27, 2022 at 07:16:32PM +0000, kdevel via Digitalmars-d wrote:
 On Friday, 27 May 2022 at 19:10:59 UTC, H. S. Teoh wrote:
 On Fri, May 27, 2022 at 06:46:36PM +0000, kdevel via Digitalmars-d
 wrote:
 https://dlang.org/phobos/std_process.html#browse
 
    void browse(scope const(char)[] url);
       Start up the browser and set it to viewing the page at url.
 
 It feels wrong that this function is in std.process.
Where would be a better place for it?
In std.useragents?
A completely separate module seems unwarranted. Maybe a submodule of std.process? Like std.process.programs? std.process.clients? Something like that. T -- Marketing: the art of convincing people to pay for what they didn't need before which you fail to deliver after.
May 27 2022
prev sibling next sibling parent reply Jack <jckj33 gmail.com> writes:
On Friday, 27 May 2022 at 18:46:36 UTC, kdevel wrote:
 https://dlang.org/phobos/std_process.html#browse

    void browse(scope const(char)[] url);
       Start up the browser and set it to viewing the page at 
 url.

 It feels wrong that this function is in std.process.
I think it belong to the process module. I wonder why it's there tho. So unusual to have such function in the std process.
May 27 2022
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
Its not that unusual, and it can be quite useful.

https://docs.oracle.com/javase/9/docs/api/java/awt/Desktop.html#browse-java.net.URI-

https://developer.apple.com/documentation/uikit/uiapplication/1648685-open
May 27 2022
parent kdevel <kdevel vogtner.de> writes:
On Friday, 27 May 2022 at 19:34:32 UTC, rikki cattermole wrote:
 Its not that unusual,
In ISO-C++ there is no such function.
 and it can be quite useful.
So is std.process.water_the_flowers.
 https://docs.oracle.com/javase/9/docs/api/java/awt/Desktop.html#browse-java.net.URI-
That is AWT. std.process is not a windowing toolkit.
 https://developer.apple.com/documentation/uikit/uiapplication/1648685-open
std.process is not about user interfaces.
May 27 2022
prev sibling parent user1234 <user1234 12.de> writes:
On Friday, 27 May 2022 at 18:46:36 UTC, kdevel wrote:
 https://dlang.org/phobos/std_process.html#browse

    void browse(scope const(char)[] url);
       Start up the browser and set it to viewing the page at 
 url.

 It feels wrong that this function is in std.process.
This is a legacy function comming from the first the std.process version. That function existed and was kept after the [redesign]. It's usefulness was a bit discussed [at that time]. Valid point to my eyes is that it does not return a PID, you cant pipe it, you can wait it. [redesign]: https://github.com/dlang/phobos/pull/1151 [at that time]: https://forum.dlang.org/search?q=browse&scope=threadmd5%3Af6005efc9c5f341f2fe880f9c7af8949
May 28 2022