[PD-dev] [ pure-data-Bugs-2026128 ] symbol/float definition, implementation, and docs unclear

SourceForge.net noreply at sourceforge.net
Sat Jul 26 17:44:51 CEST 2008


Bugs item #2026128, was opened at 2008-07-23 17:02
Message generated for change (Settings changed) made by eighthave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
>Summary: symbol/float definition, implementation, and docs unclear 

Initial Comment:
If you start with a symbolic atom in a symbol message, then run it thru a [list trim], you end up with a mystery type that is just a numeric atom, but does not work as a float message.

see attached patch for an example

----------------------------------------------------------------------

Comment By: Frank Barknecht (fbar)
Date: 2008-07-26 05:35

Message:
Logged In: YES 
user_id=569446
Originator: NO

If you want 1234 to be a number, then don't use [makefilename %d] to
deliberatly turn it into a symbol! As soon as you've created a symbol out
of
1234, it behaves like a symbol until you convert it back. Pd doesn't have
a
builtin object to turn symbols into numbers (e.g. "tonumber" in Lua) but
that's
a different bug. Regarding duck-typing, even in Python the following
raises an
error: 

>>> a = 1234
>>> a.__str__()
'1234'
>>> 5678 + a.__str__()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for +: 'int' and 'str'

as does 1 + "2".

If you want to file a documentation bug, then please do so. If you want
to
remove the ability to create symbols with digits from Pd, then file a
feature
request. If you want A_SYMBOLs with only digits to be treated as floats
everywhere (which is practically the same as removing the ability to
create
such symbols), then again file a feature request about this. But the bug
report
you've written (just read it again) does not describe any of this.  

I believe I've said all there is in this matter. I'm too tired now to
continue
to play bug-status ping-pong so this was my last response.

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-25 17:19

Message:
Logged In: YES 
user_id=27104
Originator: YES

If this behavior is intended and desired, then it should be documented.  I
personally think that Pd should follow duck-typing style with this
question, and that might be a problem bigger than this one place.

Since you are a big fan of langauges that use duck-typing (Lua, Python), I
am surprised that you think this is not a problem.  I put all of the
definitions that I could find of Pd's atoms here
http://puredata.info/dev/PdDefinitions and this is what I found on this
topic:

Pd Manual 2.1.2: "Atoms are either numbers or symbols like +. "
Pd Manual 2.6.1: "...atom (number/symbol)..."
Pd Manual 2.1.2: "Anything that is not a valid number is considered a
symbol." 
>From float-help.pd: "The float object stores a number"

>From all the references I could find where Miller defines floats and
symbols, it seems pretty clear that the intention was to have anything that
we perceive as a  number interpreted as a float.  I agree with this and
think that it should be consistently implemented throughout Pd.

----------------------------------------------------------------------

Comment By: Frank Barknecht (fbar)
Date: 2008-07-25 02:09

Message:
Logged In: YES 
user_id=569446
Originator: NO

I repeat: There is *no* mystery type, please don't invent things without
reason. What is there is a symbol with numeric content after
[makefilename]. It acts like any other symbol, nothing else, nothing
undocumented. [list trim] removes the selector so you're left with the bare
symbol. You can get it back with [symbol] or [list]. Without
"symbol"-selector it rightfully doesn't match [route symbol] or [select
1234], only to its own selector, which is symbol("1234") that you can
create again with [makefilename], as numeric-symbol.pd shows. Pd cannot
save these symbols, but never promised to do so.

I'm putting you're report into "Pending" now, it is vague and invalid.

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 23:24

Message:
Logged In: YES 
user_id=27104
Originator: YES

This discussion is going quite far afield from the original issue.  I can
see no reason why there should be such a mystery type, given the current
type system.  So either it should be fixed or documented.

----------------------------------------------------------------------

Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 02:20

Message:
Logged In: YES 
user_id=569446
Originator: NO

Oh, and logically the negation of "Anything that is not a valid number is
considered a symbol." is not: "Everything that looks like a valid number is
a float." Numeric symbols created with makefilename aren't valid numbers. 

Besides that, the sentence you quote is in chapter "2.1.2. object boxes"
and only deals with how Pd reads the content of object boxes, not with the
general type system of Pd. Pointers or gemstates wouild be example of "not
a valid number"s which still aren't symbols. But pointers cannot be used in
object boxes neither.

----------------------------------------------------------------------

Comment By: Frank Barknecht (fbar)
Date: 2008-07-24 02:09

Message:
Logged In: YES 
user_id=569446
Originator: NO

Then you should report that "inconsistency" and not something else. The
behaviour you dislike has nothing to do with [list trim] nor with
conversions nor mysteries.

The only problem here is, that certain symbols cannot directly be
represented in Pd's patch format. This includes symbols with a pure numeric
content - which Pd reads as numbers in a patch file - but also many other
symbols like those for whitespace characters (SPACE, TAB,...), the
backslash etc. To use these, you have to create them with something like
[makefilename], but after that, they get treated correctly by all builtin
objects, especially [select] or [list]. 

See attached example.
File Added: numeric-symbol.pd

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-07-24 00:40

Message:
Logged In: YES 
user_id=27104
Originator: YES

This is a question of how should Pd behave, now how it currently does.  If
there is supposed to be such a thing as "a symbolic atom that is a number,
but without a symbol selector", then it should be fully supported and
documented.  But this is the current definition of a symbolic atom (Pd
manual 2.1.2):

"Anything that is not a valid number is considered a symbol." 

By taking the converse of the above rule, "1234" looks like a valid number
so it should be a float.  That inconsistency is the bug that I am trying to
highlight.

----------------------------------------------------------------------

Comment By: Frank Barknecht (fbar)
Date: 2008-07-23 19:38

Message:
Logged In: YES 
user_id=569446
Originator: NO

I hope even with all my spelling mistakes you can understand my previous
post  ...  Is it possible to edit posts?

----------------------------------------------------------------------

Comment By: Frank Barknecht (fbar)
Date: 2008-07-23 19:36

Message:
Logged In: YES 
user_id=569446
Originator: NO

Yeah, these "mystery types" can be confusing, but in reality they are just
ordinary symbols with a pure numeric data part. Note that these numeric
symbols are not numbers or floats! 

[list trim] removes the selector, so after that you have a "1234" string
without selector (or with "symbol 1234" as selector, but minus the "symbol"
part. You can covert this back to a Pd-symbol with a [symbol] or [list]
object. However as you cannot represent numberic symbols in a saved Pd
patch, you cannot use [select 1234] or [route 1234] to select or route
them. 

However you can use [select -DUMMY-] and prime that with a numeric symbol
created with [makefilename %d] construct to its left inlet to select
numeric symbols. The same "trick" is used to select backslashes or other 
for example split a symbol at any other "unusual" symbol using
[list2symbol]. Try 92---[makefilename %c] to split at backslashes, for
example.

Anyway, there's nothing mysterious about numeric symbols, they are just
unusual in Pd. I think, we had similar confusions before in the bug
tracker, but I didn't check.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2026128&group_id=55736




More information about the Pd-dev mailing list