[erlang-questions] why syntax error

Jeroen Koops koops.j@REDACTED
Thu Apr 15 09:05:55 CEST 2010


As an alternative to list_to_pid/1, you can use pid/3:

1> pid(0,12,0).
<0.12.0>

I think it's part of the c module.

On Thu, Apr 15, 2010 at 1:19 AM, Andrew Stone <stondage123@REDACTED> wrote:

> I would also appreciate having some type of access to writeable pids this
> in the shell , so I don't have to do the list_to_pid/1 dance so often.
> However, I fully understand the rationale behind the original decision to
> make those values read-only.
>
> BTW, Geoff, your disclaimer reminds me of this.
>
> http://github.com/SFEley/candy/blob/master/LICENSE.markdown
>
> -Andrew
>
>
>
> ----- Original Message ----
> From: Geoff Cant <nem@REDACTED>
> To: Robert Virding <rvirding@REDACTED>
> Cc: erlang-questions@REDACTED
> Sent: Wed, April 14, 2010 6:48:36 PM
> Subject: Re: [erlang-questions] why syntax error
>
>
>
> Robert Virding <rvirding@REDACTED> writes:
>
> > There is no no printed representation of pids (process ids) or ports
> > which can be read in to return the pid or port. So #Port<0.2808> and
> > <0.1112.0> is not valid syntax.
> >
> > This is not accidental but deliberate as creating ports/pids in this
> > fashion is very unsafe and can really screw things up.
> >
> > Robert
>
> I'd agree it's not something you should want often.
>
> That said, I wouldn't mind a '[{debugging, production}, {please,
> help_help_help}]' option for the shell that would add reader syntax
> (only in the shell) for #Port<X.Y.Z> and <X.Y.Z> so that I could copy
> and paste pids/ports from log messages and debugging output right back
> into new commands. Would save me typing pid(X,Y,Z) and/or
> list_to_pid("<X.Y.Z>") quite so often.
>
> The standard OTP disclaimer[1] would of course would apply.
>
> --
> Geoff Cant
>
> [1] I, <name of the developer> undersigned, do hereby acknowledge that I
>    know that what I'm about to do is generally a bad idea. The OTP team
>    documented that it was a bad idea, explained why it was a bad idea,
>    generally tried to encourage me not to do it and yet I am going to
>    do it anyway.
>
>    When my hubris leads me to trash the production cluster, not only do
>    I disclaim any right to get mad, complain on the mailing list or
>    twitter, I will in fact praise the OTP team for their foresight and
>    volunteer to write an even sterner warning in the documentation for
>    future reference.
>
>    Should I break this agreement by uttering so much as a groan when I
>    use this undocumented/deprecated/debugging-only function/feature
>    shoot myself in the foot, I promise to buy the OTP team a round at
>    the next Erlounge.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list