[erlang-questions] why syntax error

Geoff Cant <>
Thu Apr 15 00:48:36 CEST 2010



Robert Virding <> 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.


More information about the erlang-questions mailing list