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
5
votes
2 answers

How can I avoid this error produced while using 'strict'?

I have a couple of lines of code that work if use strict; is commented out. However, I don't want to have it disabled for the entire script just because of one small section. I need to either recode it, or somehow disable use strict; temporarily…
CheeseConQueso
  • 5,831
  • 29
  • 93
  • 126
5
votes
2 answers

Which tags are can be self closing and which ones must have a closing tag in XHTML 1.0 Strict?

Which tags are can be self closing and which ones must have a closing tag in XHTML 1.0 Strict? Example:
Are there certain tags that must have a closing tag, can be self closing, or eigther way works in XHTML 1.0 Strict?
John Egbert
  • 5,496
  • 8
  • 32
  • 44
5
votes
1 answer

Flutter 'Strict' Mode?

In most languages, when you attempt to use a null pointer, an exception will get thrown. In Flutter however, this doesn't seem to be the case. Instead of throwing an exception, it simply stops executing the function. void test() { Map
Brad Hesse
  • 648
  • 6
  • 15
5
votes
4 answers

Visual Studio 2017 - Option Strict will not turn off

After a recent update on VS2017. I'm seeing lots of Late binding errors on all projects. The errors are showing because Option Script of set to on somewhere, but all my projects have the option Option Strict set to Off. On some projects even if I…
Walsharoo
  • 76
  • 6
5
votes
2 answers

Assign STDIN to variable in strict mode

The following code works quite as intended when using no strict: my $file = STDIN; while (<$file>) { print "$_\n"; } How would be an equal solution using use strict;? I've tried so far: ${STDIN}, $STDIN, \$STDIN, , and \STDIN, and I am…
Manuel Faux
  • 2,317
  • 5
  • 24
  • 35
5
votes
3 answers

Node JS avoid laboriously adding "use strict" to all my files

So I want to enable strict mode for my project, but I have a lot of files and adding "use strict"; to the top of all of them would be a pain. I discovered the --use_strict CLI option for node which is awesome, but enables it for every single file…
Jazcash
  • 3,145
  • 2
  • 31
  • 46
5
votes
2 answers

Perl Global symbol requires explicit package name

I am trying to store my log messages in a hash depending upon message type as shown below: #!/usr/bin/perl use strict; use warnings; my %log; opendir (DIR, '.') or die $!; while (my $file = readdir(DIR)) { # some code to select TAR filename…
i01000001
  • 119
  • 1
  • 2
  • 9
5
votes
2 answers

Enforcing strict mode in google-apps-script files using Chrome on Chromebook

In google-apps-script script file is it possible to set 'use strict'? I've created a function to test this function a () { //logs - function a "use strict"; Logger.log(arguments.callee); } If strict mode was being enforced, I would think this…
user1472330
  • 123
  • 1
  • 10
5
votes
3 answers

Strict Standards: Only variables should be passed by reference - php error

$file_name = $_FILES['profile_image']['name']; $file_ext = end(explode('.', $file_name)); //line 10 $file_ext = strtolower($file_ext); $file_temp = $_FILES['profile_image']['tmp_name']; Strict Standards: Only variables should be…
user1578012
4
votes
2 answers

How to make existing angular application "fully strict" step by step?

I have an existing Angular Application that started development at the time of Angular 4, now it's on Angular 12. But at the time of development, the strict mode was not enabled. Now after the application is stable and also deployed on production,…
HassanMoin
  • 2,024
  • 1
  • 6
  • 16
4
votes
2 answers

Stricter than strict mode?

I recently produced a stupid bug: "use strict"; function doSomething() { let testObject = {a: "foo", b: "bar", parent: "bla"}; if (parent in testObject) { console.log("has a parent") } else { console.log("does not…
Philipp Imhof
  • 204
  • 1
  • 7
4
votes
2 answers

Perl - Array reference, using strict

I have the following code: my @array = ('a', 'b', 'c'); my $region = \@array; # Returns an array reference my $Value = ${@{$region}}[3]; I am using strict; This code passed smoothly in Perl v5.8.6, and now that I installed v5.10.1, I get a…
Gal Goldman
  • 8,641
  • 11
  • 45
  • 45
4
votes
1 answer

Why do some variables require initialization and some don't in the same script?

I am experimenting with Perl, and have written the following quadratic equation solver. #! perl use strict; use Math::Complex; use v5.22; say "Quadratic Equation Solver"; print "Enter a: "; $a = ; print "Enter b: "; $b = ; print…
qwerty
  • 810
  • 1
  • 9
  • 26
4
votes
1 answer

Can I disable distinguishing between null and undefined in TypeScript strict null-checking mode?

I'm currently converting a large TypeScript codebase to strict null-checks. The codebase has many types with optional members: interface MyInterface { member1?: number; member2?: string; } Furthermore, it uses a type Nullable = T | null, and…
Jonas Sourlier
  • 13,684
  • 16
  • 77
  • 148
4
votes
3 answers

Is it possible to get access to a symbol table without disabling strict?

In Perl the following code is very common. You can even see it in things like constant.pm. my $symtab; { no strict 'refs'; …
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468