Skip Menu |

This queue is for tickets about the Submodules CPAN distribution.

Report information
The Basics
Id: 107649
Status: resolved
Worked: 32 min
Priority: 0/
Queue: Submodules

People
Owner: ZARABOZO [...] cpan.org
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

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



Subject: Result->use considered tragic design decision
    $i->use;  # Equivalent to 'use Some::Module'

 

^ This is dangerous and will almost guaranteedly bite you in the ass later.

Why? Because a lot of `Class->import()` side effects only really work at compile time, as well as the native "use" declaration being invoked at compile, not runtime.

Calling ->import() at runtime will likely not do as you expect.

Any user who wants runtime imports should be discouraged and it should be a "experts only" option, and they should be explicitly calling ->import() themselves after the require.

 

Hello, Thank you for your comments regarding that feature. What you mention is already explained in the documentation, precisely to let the user know that compile time is important in many cases. If this is further seen as a problem, I'll probably make a much bigger emphasis on that part.

This is more a result of historical observations with things that support this feature.

Everyone who's provided something like this in the past has resulted in rather bad side effects.

As such, the feature's availability should not be visible in the synopsis, because that will encourage people to use it without first understanding the consequences.

If people are to use such a feature wisely, they should be required to see the documentation about its use in order to do so.

The present synopsis however, as stated, leads people into a false assumption that the code as demonstrated can be expected to be reliable.

On Fri Oct 09 01:03:07 2015, KENTNL wrote: Show quoted text
> As such, the feature's availability should not be visible in the > synopsis, > because that will encourage people to use it without first > understanding the > consequences.
Ok, I think you have a good point. I'll change the documentation and make a new release tomorrow to reflect what you suggest. Thanks again for your input, I really appreciate it. Zarabozo @ cpan.org
Fixed in 1.0002.