Mode used in languages such as Javascript and Perl to be able to code with a restricted version of those languages.
Questions tagged [strict]
490 questions
6
votes
1 answer
Bracket code section in use strict / no strict?
I inherited some perl code that of course doesn't use either strict or warnings, and I keep using uninitialized variables and the like.
I'd like to bracket the sections of code that I'm modifying like this:
use warnings;
use strict;
... my code…

stevesliva
- 5,351
- 1
- 16
- 39
6
votes
1 answer
Perl::Critic 'Code before strictures' when using Modern::Perl
I understand that it is best practice to use Modern::Perl rather than use strict and warnings.
With default options, Perl::Critic v1.121 complains about code before strict, even when 'use Modern::Perl' comes before code.
QUESTION: Is the best…

null
- 889
- 1
- 13
- 24
6
votes
1 answer
Does "use strict" in the constructor extend to prototype methods?
I'm trying to figure out whether the definition of 'use strict' extends to the prototype methods of the constructor. Example:
var MyNamespace = MyNamespace || {};
MyNamespace.Page = function() {
"use strict";
};
MyNamespace.Page.prototype =…

Spencer Mark
- 5,263
- 9
- 29
- 58
6
votes
1 answer
In Javascript strict mode can you assign arguments to another var?
I'm trying to validate Javascript code through Sonar and I have some doubts about strict mode rules.
The rule I'm validating is about "eval" and "arguments" behavior in strict mode.
In reading this rule description, it seems I can not assign…

lucasarruda
- 1,462
- 1
- 25
- 45
6
votes
3 answers
Using a dynamically generated variable name in Perl's strict mode
Basically, I would like to grab the contents of a variable named in a dynamically generated string, but all efforts to accomplish this in strict mode have failed. There are several posts about similar problems, but none seem to have solutions that…

user2543941
- 61
- 1
- 1
- 2
6
votes
3 answers
JavaScript 'use strict'; inside functions
Tested some js code in Chrome Dev Console and I'm a bit confused.
I know that in strict mode functions that are not methods of an object when referred to this keyword should receive undefined instead of global object.
function test(){
"use…
user1343639
6
votes
2 answers
PHP 5.4 code update - Creating default object from empty value warnings in foreach and objects array
I have following code:
foreach($foo as $n=>$ia) {
foreach($ia as $i=>$v) {
$bar[$i]->$n = $v; //here I have 'Creating default object...' warning
}
}
If I add:
$bar[$i] = new stdClass;
$bar[$i]->$n = $v;
to fix it. Then values in…

PASAf
- 115
- 1
- 7
6
votes
2 answers
Static Standards error after updating to php 5.4.9
I am getting following errors after updating php to version 5.4
Strict Standards: Non-static method Debugger::invoke() should not be called statically, assuming $this from incompatible context in /usr/share/php/cake/libs/debugger.php on line 575…

Deadlock
- 1,575
- 1
- 19
- 34
6
votes
1 answer
Is PHP execution any faster with strict standards?
I can't believe i'm not able to google anything relevant to this question, but anyway...
My logical assumption would be that scripts which obey all the rules that strict standards dictate would execute faster.
On the other hand, if the scripts WORK…

3Nex
- 517
- 6
- 14
6
votes
4 answers
jQuery callback - strict violation
I get the basic idea about this not being in a method when in strict mode outlined here, but it gets a bit erudite, to be honest. So, in more prosaic terms:
I have a handler like so:
$('.myClass').one('keyup', function() {
var $this = $(this);
…

Nick
- 5,995
- 12
- 54
- 78
5
votes
1 answer
Strict Mode Issue with Binding Arguments
I have an issue with running a test on my files. Would love if someone more experienced could help me out here.
the following code gives me this error:
error Parsing error: Binding arguments in strict mode
return (...arguments) => {
if…

Hey
- 43
- 5
5
votes
2 answers
Uncaught SyntaxError: \8 and \9 are not allowed in strict mode
I work on a project using Angular v7 and just today encountered this error Uncaught SyntaxError: \8 and \9 are not allowed in strict mode. at runtime that will not go away
I've been able to trace it back to the angular-essential-select module…

Askirkela
- 1,120
- 10
- 20
5
votes
1 answer
How to rename perl __ANON__ sub without disabling strict 'refs'?
I found a solution to renaming anonymous subs in Perl here. It involves temporarily mangling the symbol table to insert the desired name. This solution uses a hard-coded symbol table name to be replaced. My problem is that I would like to…

Steve O
- 53
- 6
5
votes
2 answers
Standards-compliant equivalent to target="_blank"
There are instances where I have to open links in a new window/tab. Is there a method of doing so that is valid for strict HTML? Using jQuery to do so would be acceptable, but I'd rather not just sneak the target="_blank"s back in w/ jQuery so that…

aslum
- 11,774
- 16
- 49
- 70
5
votes
2 answers
Is there a production safe version of Function.caller in Javascript?
Is there a way to return the function that invoked the current function? Function.caller will only work for non-strict mode applications.
I want to be able to use this functionality for production environment, therefore I need strict mode to be…

dwen
- 141
- 2
- 7