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
25
votes
6 answers
How to turn off MySQL strict mode in Rails
Upgrading to Rails 4, it seems MySQL strict mode is now on by default for Rails connections. I say this because my Rails app is getting "Mysql2::Error: Data too long for column" when saving a string value longer than 255 characters. Yet, I paste the…

mahemoff
- 44,526
- 36
- 160
- 222
23
votes
5 answers
Convert a Lazy ByteString to a strict ByteString
I have a function that takes a lazy ByteString, that I wish to have return lists of strict ByteStrings (the laziness should be transferred to the list type of the output).
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy…

Matt Joiner
- 112,946
- 110
- 377
- 526
23
votes
3 answers
How to use mixed parameter type in my own functions?
I want to define a PHP 7 function that takes a parameter of mixed type. (What I want is the equivalent of a generic type parameter in C#; if there's a better way to emulate that in PHP 7, please let me know.)
My code is as follows.

FSharpN00b
- 933
- 1
- 8
- 17
23
votes
2 answers
'caller' and 'arguments' are restricted function properties and cannot be accessed in this context
I am trying to create a simple debugging function that simply shows the caller of a function, like this:
function xe() {
console.log(xe.caller().name)
}
With this I would just be able to add xe() to a function and it will log the calls to the…

Brian M. Hunt
- 81,008
- 74
- 230
- 343
22
votes
2 answers
What validation does MySQL do when strict mode is enabled?
I was quite surprised when MySQL allowed me to insert a NULL into a field that was created with NOT NULL. I did some research and discovered how to enable strict mode. However, I am not quite sure what validation MySQL does when STRICT_ALL_TABLES is…

toxalot
- 11,260
- 6
- 35
- 58
19
votes
5 answers
Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function
Hello when I run this project in Developer mode (grunt server) https://github.com/kennethlynne/generator-angular-xl everything is ok but when I run it in production mode (grunt build) I get an `
Uncaught SyntaxError: In strict mode code, functions…

Stefanos Chrs
- 2,228
- 3
- 19
- 46
19
votes
3 answers
Using node, why is code so much faster with "use strict"?
I never knew use strict to speed up runtime, however a simple use strict is making my benchmark substantially faster, and the slower one grossly slower (over twice as slow). What's going on?
//
// RUN WITH AND WITHOUT THIS
//
"use strict";
var…

Evan Carroll
- 78,363
- 46
- 261
- 468
18
votes
1 answer
JavaScript 'strict mode' not working as expected?
var test = function() {
'use strict';
var mapNames = {
'name': 'City Name:',
'coord.lat': 'Latitute:'
};
for (var key in mapNames) {
var names;
if (mapNames[key]) {
name =…

JS-JMS-WEB
- 2,555
- 3
- 17
- 26
16
votes
2 answers
Should I worry about "window is not defined" JSLint strict mode error?
This won't pass JSLint in strict mode:
"use strict";
(function (w) {
w.alert(w);
}(window));
The error--from jslint.com--looks like this:
Problem at line 4 character 3: 'window' is not defined.
}(window));
Implied global: window 4
Do I need to…

Kent Brewster
- 2,480
- 2
- 22
- 27
14
votes
2 answers
What is the benefit of using '--strictFunctionTypes' in Typescript?
As I understand it, --strictFunctionTypes compiler option in Typescript prevents a very common use case of polymorphism from working:
type Handler = (request: Request) => Response
const myHandler: Handler = (request: Request & { extraArg: boolean…

Helios
- 191
- 1
- 5
14
votes
3 answers
How to declare array of specific type in javascript
Is it possible in java script to explicitly declare array to be an array of int(or any other type)?
something like var arr: Array(int) would be nice...

31415926
- 3,811
- 7
- 47
- 78
14
votes
2 answers
Haskell - strict vs non-strict with foldl
I have a question concerning the definition of strict vs non-strict. The Haskell wiki-book for Laziness (http://en.wikibooks.org/wiki/Haskell/Laziness), under the section "Black-box strictness analysis", makes the following assertion:
[Assuming a…

shj
- 1,558
- 17
- 23
14
votes
1 answer
How unpacking strict fields goes together with polymorphism?
The {-# UNPACK #-} pragma tells the compiler to eliminate redundant constructors. Quoting Haskell wiki:
For example, given this:
data T = T {-# UNPACK #-} !(Int,Float)
GHC will represent the type T like this:
data T = T Int Float
eliminating the…

Petr
- 62,528
- 13
- 153
- 317
13
votes
13 answers
Is it worth the development time to output valid HTML?
Developing websites are time-consuming. To improve productivity, I would code a prototype to show to our clients. I don't worry about making the prototype comform to the standard. Most of the time, our clients would approve the prototype and give an…

MrValdez
- 8,515
- 10
- 56
- 79
12
votes
5 answers
Time cost of Haskell `seq` operator
This FAQ says that
The seq operator is
seq :: a -> b -> b
x seq y will evaluate x, enough to check that it is not bottom, then
discard the result and evaluate y. This might not seem useful, but it
means that x is guaranteed to be evaluated…

quant_dev
- 6,181
- 1
- 34
- 57