Questions tagged [strict]

Mode used in languages such as Javascript and Perl to be able to code with a restricted version of those languages.

490 questions
7
votes
4 answers

VB6: Disable variants

I have a large VB6 projects where a lot of variables don't have an explicitly defined type, so they automaticly default to Variant type. Finding all those by hand is a massive task, so is there any way to automate this? In VB.Net it's possible to…
Maestro
  • 9,046
  • 15
  • 83
  • 116
7
votes
1 answer

PowerShell - how to determine programmatically whether StrictMode is set?

I know that I can override in a script or function the StrictMode setting inherited from a higher scope. But how can I find out in a script or function what the inherited setting is?
wfr
  • 155
  • 9
7
votes
1 answer

How to enable mysql strict mode globally and have it stay on?

How do I enable MySQL strict mode globally, and have it stay on? I have tried these commands: SET sql_mode = TRADITIONAL; SET sql_mode = ANSI_QUOTES; But they only set the mode for the current session.
Chris Muench
  • 17,444
  • 70
  • 209
  • 362
7
votes
2 answers

In javavscript, what is the difference between: (function(){"use strict"}) (); and "use strict"?

What is the difference between: (function () {'use strict';})(); and "use strict". I don't understand when or why I would use one over the other? I think that one declares the complete external JS document strict and the other makes a function…
Starkemp315
  • 151
  • 1
  • 1
  • 4
7
votes
0 answers

Changing the execution scope of eval method - strict mode versus with statement

I have implemented some module, which simplified code is shown below: (function() { var context = {...}; // an object which serves as the context for the expression being evaluated with (context) { var x = eval(expression); …
jwaliszko
  • 16,942
  • 22
  • 92
  • 158
7
votes
3 answers

Was Douglas Crockford wrong with Strict Mode Example?

I'm sure he wasn't. I just don't understand one example from his presentation http://youtu.be/UTEqr0IlFKY?t=44m function in_strict_mode() { return (function () { return !this; }()); } Isn't it the same like this one? function…
Arūnas Smaliukas
  • 3,231
  • 6
  • 27
  • 46
7
votes
2 answers

How is strict mode ("use strict";) inherited by functions?

Here is my code that seems to indicate that the answer is yes - http://jsfiddle.net/4nKqu/ var Foo = function() { 'use strict' return { foo: function() { a = 10 alert('a = ' + a) } } }() try { …
Lone Learner
  • 18,088
  • 20
  • 102
  • 200
7
votes
3 answers

Are there any differences between our defined variables and normal global variables in Perl?

Is the our modifier only used when strict pragma is active to let using global variables or is it even used for some extra features different from normal global variables when strict is off?
Acsor
  • 1,011
  • 2
  • 13
  • 26
6
votes
3 answers

Javascript: besides "use strict", which other "use" directives are there?

Besides use strict, which other use directives are there?
fbas
  • 1,676
  • 3
  • 16
  • 26
6
votes
5 answers

How to initialise the MatPaginator as a @ViewChild member variable?

I'm coding in Visual Studio Code an Angular 8 project and just added some strict mode configuration: "compilerOptions": { "strict": true, "noImplicitAny": true, "noImplicitThis": true, "alwaysStrict": true, "strictNullChecks": true, …
Stephane
  • 11,836
  • 25
  • 112
  • 175
6
votes
1 answer

Known JavaScript Directives

The ECMAScript specification defines the Use Strict Directive, but permits implementations to define their own directives. From here: Implementations may define implementation specific meanings for ExpressionStatement productions which are not a…
Jackson
  • 9,188
  • 6
  • 52
  • 77
6
votes
5 answers

Perl: Why is it slower to declare (my) variables inside a loop?

What's the difference, from the interpreter's POV, between the following the following programs: #!/usr/bin/perl -w use strict; for (1..10000000) { my $jimmy = $_**2; } and #!/usr/bin/perl -w use strict; my $jimmy; for (1..10000000) { …
flies
  • 2,017
  • 2
  • 24
  • 37
6
votes
1 answer

Heap overflow in Haskell

I'm getting Heap exhausted message when running the following short Haskell program on a big enough dataset. For example, the program fails (with heap overflow) on 20 Mb input file with around 900k lines. The heap size was set (through…
Glaukon
  • 321
  • 3
  • 12
6
votes
1 answer

Function.prototype.call alters typeof this, outside strict mode; why?

var example = function () { console.log(typeof this); return this; }; In strict mode: example.call('test') # prints 'string' Otherwise, example.call('test') # prints 'object' However, console.log(example.call('test')) prints test (as you'd…
hagemt
  • 328
  • 5
  • 12
6
votes
2 answers

php strict error by including

It looks like strict errors do not occur if the classes are in one file like this: abstract class Food{} class Meat extends Food{} abstract class Animal{ function feed(Food $food){ } } class Cat extends Animal{ …
mife
  • 105
  • 1
  • 6