Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: "dump" method in [text] #867

Open
jmmmp opened this issue Jan 10, 2020 · 26 comments
Open

feature request: "dump" method in [text] #867

jmmmp opened this issue Jan 10, 2020 · 26 comments
Labels
severity:feature suggestion for an enhancement

Comments

@jmmmp
Copy link

jmmmp commented Jan 10, 2020

With a dump method, it's possible to get the complete contents of a text, without building some specific circuit for it.

@umlaeute umlaeute added the severity:feature suggestion for an enhancement label Mar 5, 2020
@Spacechild1
Copy link
Contributor

Spacechild1 commented Mar 29, 2022

What exactly do you mean with "complete contents"? In which format would you except to get content?

@porres
Copy link
Contributor

porres commented Mar 29, 2022

I guess all lines sequentially?

@Spacechild1
Copy link
Contributor

What about seperators? And what's the use case?

BTW, there's already [text tolist], but that's probably not what @jmmmp wants.

@Spacechild1
Copy link
Contributor

BTW, that's probably the easiest way to get the whole text as a single list:

grafik

A "text dump" method could do this a bit more efficiently (i.e. omit the final list copy), but I'm not sure it's a common enough operation to optimize for.

@reduzent
Copy link
Contributor

Isn't that what [text tolist] does? It does it in a way so that the whole text buffer can be restored with [text fromlist].

If [text dump] is meant to output all lines sequentially, then there is already [text sequence]. I don't see what [text dump] could bring to the table that is new.

@Spacechild1
Copy link
Contributor

Spacechild1 commented Mar 29, 2022

Isn't that what [text tolist] does?

Not really. [text tolist] converts the atoms to plain text, i.e. semi and comma atoms are converted to symbols and special characters inside symbols are escaped. For example, you can use this to save the whole content of [text define] with [savestate], as mentioned in savestate-help.pd. (It would be nice if this could also be mentioned in the help for [text tolist] and [text fromlist]. Ping @porres).

@Spacechild1
Copy link
Contributor

I don't see what [text dump] could bring to the table that is new.

The only thing that I can imagine is joining all lines to a single list, ignoring all seperators and without conversion. I'm not saying there aren't any use cases for this, but I'm not sure they are frequent enough to warrant a dedicated function...

@reduzent
Copy link
Contributor

Ok, I understand now the third case. But then I feel even stronger that an implementation that intentionally loses much information warrants its own subclass. I consider it a quite specialized case.

@jmmmp
Copy link
Author

jmmmp commented Apr 2, 2022 via email

@Spacechild1
Copy link
Contributor

@jmmmp

Which is the contrary to [text tolist]: to get all lines in a text object with one click.

The opposite of [text tolist] is [text fromlist].

basically it would be the same function as dump in cyclone/coll.

The [dump( method for [cyclone/coll] outputs all lines sequentially. This is the same as sending [line 0, bang( to [text sequence]. So what are you missing exactly?

@porres
Copy link
Contributor

porres commented Apr 3, 2022

we could make that more explicit as a functionality in the documentation

@jmmmp
Copy link
Author

jmmmp commented Apr 4, 2022 via email

@Spacechild1
Copy link
Contributor

I don't use [text sequence], as that concept isn't that interesting to me.

You should really check the documentation of an object before making a feature request...

But if something is there and now is clear, I can have a quick look to see if it works.

Yes please :-) I've already posted an example: #867 (comment)

@porres
Copy link
Contributor

porres commented Apr 4, 2022

Trying to think of a new 'dump' message...

maybe create a 'dump' message for [text sequence] that would be the same as "line 0, bang" but would also ignore waits (not stopping when reaching them).

@Spacechild1
Copy link
Contributor

but would also ignore waits (not stopping when reaching them).

But that's what [line 0, bang( already does?

@porres
Copy link
Contributor

porres commented Apr 4, 2022

But that's what [line 0, bang( already does?

nope, if you have waits, it'll stop at them.

@Spacechild1
Copy link
Contributor

nope, if you have waits, it'll stop at them.

But only if you use the -w flag... Otherwise it certainly doesn't.

I think you just read the documentation, which indeed says:

output all lines starting from current one to next waiting point

This is actually not quite correct.

@porres to the rescue!

@porres
Copy link
Contributor

porres commented Apr 4, 2022

yeah, the whole thing says "This is a zero length list. It output all lines starting from current one to next waiting point (but note there aren't any waits in this example so all lines are output)"

and yeah, you need flags to specify waits.

so, my idea of a dump message would be to ignore waits and output them all sequentially anyway

@porres
Copy link
Contributor

porres commented Apr 4, 2022

there's a typo there, should be "outputs"

@Spacechild1
Copy link
Contributor

yeah, the whole thing says "This is a zero length list. It output all lines starting from current one to next waiting point (but note there aren't any waits in this example so all lines are output)"

Ah, I didn't look at the most recent Pd version :-) So this is already covered.

so, my idea of a dump message would be to ignore waits and output them all sequentially anyway

But we already have [line 0, bang( -> [text sequence]... Why do we need a "dump" method?

Maybe the [line 0, bang( "trick" could be mentioned explicitly somewhere in the [text] documentation?

@porres
Copy link
Contributor

porres commented Apr 4, 2022

Why do we need a "dump" method?

In my idea, it would output everything EVEN if we have waits, cause it'll stop now if we have waits...

Not that I have a use case for this, and this is also not what this original request needs

@Spacechild1
Copy link
Contributor

Spacechild1 commented Apr 4, 2022

In my idea, it would output everything EVEN if we have waits, cause it'll stop now if we have waits...

??? If you don't want to use waits, you wouldn't write [text sequence -w] in the first place....

[line 0, bang( -> [text sequence] does exactly what a "dump" method would do...

@porres
Copy link
Contributor

porres commented Apr 4, 2022

But I have to say that a "dump" message to plain [text] ("text define") wouldn't be bad!

@Spacechild1
Copy link
Contributor

Spacechild1 commented Apr 4, 2022

But I have to say that a "dump" message to plain [text] ("text define") wouldn't be bad!

[text define] and [array define] are just there to define an object. Then you have several "method" to interact with the object. So I'm pretty sure that [text define] should not get a "dump" method.

I would agree that [line 0, bang( -> [text sequence] might not be the most obvious mechanism, but I think it's largely a matter of documentation.

Anyway, we're now only talking about semantic sugar. There is nothing a "dump" method would offer in terms of functionality. It wouldn't even save a lot of keystrokes...

@porres
Copy link
Contributor

porres commented Apr 4, 2022

??? If you don't want to use waits, you wouldn't write [text sequence -w] in the first place....

I don't have a use case, but it would allow one to use both

@Spacechild1
Copy link
Contributor

I don't have a use case, but it would allow one to use both

??? You can have both [text sequence] and [text sequence -w] in the same patch, depending on what you want to do...

I think it's always a good idea to come up with a use case before proposing a feature ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity:feature suggestion for an enhancement
Projects
None yet
Development

No branches or pull requests

5 participants