Skip Menu |

This queue is for tickets about the Acme-MetaSyntactic CPAN distribution.

Report information
The Basics
Id: 124282
Status: open
Priority: 0/
Queue: Acme-MetaSyntactic

People
Owner: Nobody in particular
Requestors: mhasch-cpanbugs [...] cozap.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.014
Fixed in: (no value)



Subject: Option to get unique items
Acme::MetaSyntactic is intended to provide metasyntactic names for use in sample code. Sample code, like most any code, will want to use individual names for distinct entities. Thus it should be possible to ask for a specified number of truly distinct names, and to get either that or the information that the theme does not have enough items. Current behaviour is that meta() silently returns duplicate items once the theme is exhausted. Thus changing themes might inadvertently introduce name conflicts. I'd suggest a new method umeta() or unique_meta() to either return unique items or raise an exception. The metafy utility should make use of that, and complain if the target theme is insufficiently equipped for the given input. -Martin
On Wed Jan 31 05:05:45 2018, MHASCH wrote: Show quoted text
> Acme::MetaSyntactic is intended to provide metasyntactic names for use > in sample code. > Sample code, like most any code, will want to use individual names for > distinct entities. > Thus it should be possible to ask for a specified number of truly > distinct names, and to get either that or the information that the > theme does not have enough items.
One way to achieve this is to ask explicitely for 0 items, which will return all unique elements from the theme/category. In fact, you can also get the total number of items using this technique, according to the documentation: If $count is 0, the whole list is returned (this may vary depending on the "behaviour" of the theme) in list context, and the size of the list in scalar context. Show quoted text
> Current behaviour is that meta() silently returns duplicate items once > the theme is exhausted. > Thus changing themes might inadvertently introduce name conflicts.
This issue is unavoidable, since themes can have as little as 4 items (shadok) or 30000+ (unicode). Show quoted text
> The metafy utility should make use of that, and complain if the target > theme is insufficiently equipped for the given input.
This utility will probably work better than metafy: https://metacpan.org/pod/Acme::PPIx::MetaSyntactic -- BooK