Commit | Line | Data |
---|---|---|
69bcf1d3 FC |
1 | #!/usr/bin/perl |
2 | # | |
3 | # Regenerate (overwriting only if changed): | |
4 | # | |
5 | # lib/feature.pm | |
f2c01b15 | 6 | # feature.h |
69bcf1d3 | 7 | # |
3489ea76 | 8 | # from information hardcoded into this script and from two #defines |
d73d634c | 9 | # in perl.h. |
69bcf1d3 FC |
10 | # |
11 | # This script is normally invoked from regen.pl. | |
12 | ||
13 | BEGIN { | |
3d7c117d | 14 | require './regen/regen_lib.pl'; |
69bcf1d3 FC |
15 | push @INC, './lib'; |
16 | } | |
69bcf1d3 | 17 | |
3b8e6999 N |
18 | use strict; |
19 | use warnings; | |
c452a42f FC |
20 | |
21 | ########################################################################### | |
22 | # Hand-editable data | |
23 | ||
c6b36e45 | 24 | # (feature name) => (internal name, used in %^H and macro names) |
69bcf1d3 | 25 | my %feature = ( |
67bdaa9e FC |
26 | say => 'say', |
27 | state => 'state', | |
28 | switch => 'switch', | |
cec892e7 | 29 | bitwise => 'bitwise', |
67bdaa9e FC |
30 | evalbytes => 'evalbytes', |
31 | current_sub => '__SUB__', | |
baabe3fb | 32 | refaliasing => 'refaliasing', |
158becca | 33 | postderef_qq => 'postderef_qq', |
67bdaa9e | 34 | unicode_eval => 'unieval', |
82d83da3 | 35 | declared_refs => 'myref', |
67bdaa9e | 36 | unicode_strings => 'unicode', |
2a4315f8 | 37 | fc => 'fc', |
30d9c59b | 38 | signatures => 'signatures', |
813e85a0 | 39 | isa => 'isa', |
0b657b19 | 40 | indirect => 'indirect', |
1ad5a39c | 41 | multidimensional => 'multidimensional', |
0f2beabb | 42 | bareword_filehandles => 'bareword_filehandles', |
a1325b90 | 43 | try => 'try', |
f79e2ff9 | 44 | defer => 'defer', |
9c9853e8 | 45 | extra_paired_delimiters => 'more_delims', |
69bcf1d3 FC |
46 | ); |
47 | ||
40e4d872 FC |
48 | # NOTE: If a feature is ever enabled in a non-contiguous range of Perl |
49 | # versions, any code below that uses %BundleRanges will have to | |
50 | # be changed to account. | |
51 | ||
52fc5c56 | 52 | # 5.odd implies the next 5.even, but an explicit 5.even can override it. |
3b8e6999 N |
53 | |
54 | # features bundles | |
0f2beabb | 55 | use constant V5_9_5 => sort qw{say state switch indirect multidimensional bareword_filehandles}; |
3b8e6999 N |
56 | use constant V5_11 => sort ( +V5_9_5, qw{unicode_strings} ); |
57 | use constant V5_15 => sort ( +V5_11, qw{unicode_eval evalbytes current_sub fc} ); | |
58 | use constant V5_23 => sort ( +V5_15, qw{postderef_qq} ); | |
59 | use constant V5_27 => sort ( +V5_23, qw{bitwise} ); | |
cdba169f RS |
60 | |
61 | use constant V5_35 => sort grep {; $_ ne 'switch' | |
d5c835da | 62 | && $_ ne 'bareword_filehandles' |
cdba169f | 63 | && $_ ne 'indirect' |
3d1a4f06 | 64 | && $_ ne 'multidimensional' } +V5_27, qw{isa signatures}; |
3b8e6999 | 65 | |
69bcf1d3 | 66 | my %feature_bundle = ( |
3b8e6999 | 67 | all => [ sort keys %feature ], |
0f2beabb | 68 | default => [ qw{indirect multidimensional bareword_filehandles} ], |
3b8e6999 N |
69 | # using 5.9.5 features bundle |
70 | "5.9.5" => [ +V5_9_5 ], | |
71 | "5.10" => [ +V5_9_5 ], | |
72 | # using 5.11 features bundle | |
73 | "5.11" => [ +V5_11 ], | |
74 | "5.13" => [ +V5_11 ], | |
75 | # using 5.15 features bundle | |
76 | "5.15" => [ +V5_15 ], | |
77 | "5.17" => [ +V5_15 ], | |
78 | "5.19" => [ +V5_15 ], | |
79 | "5.21" => [ +V5_15 ], | |
80 | # using 5.23 features bundle | |
81 | "5.23" => [ +V5_23 ], | |
82 | "5.25" => [ +V5_23 ], | |
83 | # using 5.27 features bundle | |
84 | "5.27" => [ +V5_27 ], | |
85 | "5.29" => [ +V5_27 ], | |
86 | "5.31" => [ +V5_27 ], | |
87 | "5.33" => [ +V5_27 ], | |
915e574d RS |
88 | # using 5.35 features bundle |
89 | "5.35" => [ +V5_35 ], | |
69bcf1d3 FC |
90 | ); |
91 | ||
db629560 | 92 | my @noops = qw( postderef lexical_subs ); |
c22e17d0 | 93 | my @removed = qw( array_base ); |
db629560 | 94 | |
c452a42f | 95 | |
69bcf1d3 | 96 | ########################################################################### |
c452a42f | 97 | # More data generated from the above |
69bcf1d3 | 98 | |
9f601cf3 TC |
99 | if (keys %feature > 32) { |
100 | die "cop_features only has room for 32 features"; | |
101 | } | |
102 | ||
103 | my %feature_bits; | |
104 | my $mask = 1; | |
105 | for my $feature (sort keys %feature) { | |
106 | $feature_bits{$feature} = $mask; | |
107 | $mask <<= 1; | |
108 | } | |
109 | ||
52fc5c56 FC |
110 | for (keys %feature_bundle) { |
111 | next unless /^5\.(\d*[13579])\z/; | |
112 | $feature_bundle{"5.".($1+1)} ||= $feature_bundle{$_}; | |
113 | } | |
114 | ||
f2c01b15 FC |
115 | my %UniqueBundles; # "say state switch" => 5.10 |
116 | my %Aliases; # 5.12 => 5.11 | |
117 | for( sort keys %feature_bundle ) { | |
118 | my $value = join(' ', sort @{$feature_bundle{$_}}); | |
119 | if (exists $UniqueBundles{$value}) { | |
120 | $Aliases{$_} = $UniqueBundles{$value}; | |
121 | } | |
122 | else { | |
123 | $UniqueBundles{$value} = $_; | |
124 | } | |
125 | } | |
40e4d872 FC |
126 | # start end |
127 | my %BundleRanges; # say => ['5.10', '5.15'] # unique bundles for values | |
128 | for my $bund ( | |
129 | sort { $a eq 'default' ? -1 : $b eq 'default' ? 1 : $a cmp $b } | |
130 | values %UniqueBundles | |
131 | ) { | |
03222170 | 132 | next if $bund =~ /[^\d.]/ and $bund ne 'default'; |
40e4d872 FC |
133 | for (@{$feature_bundle{$bund}}) { |
134 | if (@{$BundleRanges{$_} ||= []} == 2) { | |
135 | $BundleRanges{$_}[1] = $bund | |
136 | } | |
137 | else { | |
138 | push @{$BundleRanges{$_}}, $bund; | |
139 | } | |
140 | } | |
141 | } | |
69bcf1d3 | 142 | |
47222a2d | 143 | my $HintShift; |
ada44f8c | 144 | my $HintMask; |
3489ea76 | 145 | my $Uni8Bit; |
47222a2d | 146 | |
1ae6ead9 | 147 | open "perl.h", "<", "perl.h" or die "$0 cannot open perl.h: $!"; |
3489ea76 FC |
148 | while (readline "perl.h") { |
149 | next unless /#\s*define\s+(HINT_FEATURE_MASK|HINT_UNI_8_BIT)/; | |
150 | my $is_u8b = $1 =~ 8; | |
151 | /(0x[A-Fa-f0-9]+)/ or die "No hex number in:\n\n$_\n "; | |
152 | if ($is_u8b) { | |
153 | $Uni8Bit = $1; | |
154 | } | |
155 | else { | |
ada44f8c | 156 | my $hex = $HintMask = $1; |
47222a2d FC |
157 | my $bits = sprintf "%b", oct $1; |
158 | $bits =~ /^0*1+(0*)\z/ | |
159 | or die "Non-contiguous bits in $bits (binary for $hex):\n\n$_\n "; | |
160 | $HintShift = length $1; | |
161 | my $bits_needed = | |
162 | length sprintf "%b", scalar keys %UniqueBundles; | |
163 | $bits =~ /1{$bits_needed}/ | |
164 | or die "Not enough bits (need $bits_needed)" | |
5d826eae | 165 | . " in $bits (binary for $hex):\n\n$_\n "; |
47222a2d | 166 | } |
3489ea76 | 167 | if ($Uni8Bit && $HintMask) { last } |
47222a2d | 168 | } |
3489ea76 FC |
169 | die "No HINT_FEATURE_MASK defined in perl.h" unless $HintMask; |
170 | die "No HINT_UNI_8_BIT defined in perl.h" unless $Uni8Bit; | |
171 | ||
47222a2d FC |
172 | close "perl.h"; |
173 | ||
ada44f8c FC |
174 | my @HintedBundles = |
175 | ('default', grep !/[^\d.]/, sort values %UniqueBundles); | |
176 | ||
47222a2d | 177 | |
f2c01b15 | 178 | ########################################################################### |
c452a42f | 179 | # Open files to be generated |
f2c01b15 FC |
180 | |
181 | my ($pm, $h) = map { | |
69bcf1d3 | 182 | open_new($_, '>', { by => 'regen/feature.pl' }); |
f2c01b15 | 183 | } 'lib/feature.pm', 'feature.h'; |
69bcf1d3 FC |
184 | |
185 | ||
c452a42f FC |
186 | ########################################################################### |
187 | # Generate lib/feature.pm | |
188 | ||
69bcf1d3 FC |
189 | while (<DATA>) { |
190 | last if /^FEATURES$/ ; | |
191 | print $pm $_ ; | |
192 | } | |
193 | ||
194 | sub longest { | |
195 | my $long; | |
196 | for(@_) { | |
197 | if (!defined $long or length $long < length) { | |
198 | $long = $_; | |
199 | } | |
200 | } | |
201 | $long; | |
202 | } | |
203 | ||
0bb01b05 | 204 | print $pm "our %feature = (\n"; |
69bcf1d3 | 205 | my $width = length longest keys %feature; |
ebd25686 | 206 | for(sort { length $a <=> length $b || $a cmp $b } keys %feature) { |
67bdaa9e FC |
207 | print $pm " $_" . " "x($width-length) |
208 | . " => 'feature_$feature{$_}',\n"; | |
69bcf1d3 FC |
209 | } |
210 | print $pm ");\n\n"; | |
211 | ||
69bcf1d3 | 212 | print $pm "our %feature_bundle = (\n"; |
9f601cf3 | 213 | my $bund_width = length longest values %UniqueBundles; |
88da30d7 FC |
214 | for( sort { $UniqueBundles{$a} cmp $UniqueBundles{$b} } |
215 | keys %UniqueBundles ) { | |
216 | my $bund = $UniqueBundles{$_}; | |
9f601cf3 | 217 | print $pm qq' "$bund"' . " "x($bund_width-length $bund) |
88da30d7 | 218 | . qq' => [qw($_)],\n'; |
69bcf1d3 FC |
219 | } |
220 | print $pm ");\n\n"; | |
221 | ||
88da30d7 FC |
222 | for (sort keys %Aliases) { |
223 | print $pm | |
224 | qq'\$feature_bundle{"$_"} = \$feature_bundle{"$Aliases{$_}"};\n'; | |
225 | }; | |
69bcf1d3 | 226 | |
db629560 FC |
227 | print $pm "my \%noops = (\n"; |
228 | print $pm " $_ => 1,\n", for @noops; | |
229 | print $pm ");\n"; | |
230 | ||
c22e17d0 DIM |
231 | print $pm "my \%removed = (\n"; |
232 | print $pm " $_ => 1,\n", for @removed; | |
233 | print $pm ");\n"; | |
234 | ||
ada44f8c FC |
235 | print $pm <<EOPM; |
236 | ||
0bb01b05 FC |
237 | our \$hint_shift = $HintShift; |
238 | our \$hint_mask = $HintMask; | |
239 | our \@hint_bundles = qw( @HintedBundles ); | |
3489ea76 FC |
240 | |
241 | # This gets set (for now) in \$^H as well as in %^H, | |
242 | # for runtime speed of the uc/lc/ucfirst/lcfirst functions. | |
243 | # See HINT_UNI_8_BIT in perl.h. | |
244 | our \$hint_uni8bit = $Uni8Bit; | |
ada44f8c FC |
245 | EOPM |
246 | ||
69bcf1d3 FC |
247 | |
248 | while (<DATA>) { | |
2b3fe414 FC |
249 | last if /^PODTURES$/ ; |
250 | print $pm $_ ; | |
251 | } | |
252 | ||
253 | select +(select($pm), $~ = 'PODTURES')[0]; | |
254 | format PODTURES = | |
255 | ^<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ | |
256 | $::bundle, $::feature | |
257 | . | |
258 | ||
259 | for ('default', sort grep /\.\d[02468]/, keys %feature_bundle) { | |
260 | $::bundle = ":$_"; | |
261 | $::feature = join ' ', @{$feature_bundle{$_}}; | |
262 | write $pm; | |
263 | print $pm "\n"; | |
264 | } | |
265 | ||
266 | while (<DATA>) { | |
69bcf1d3 FC |
267 | print $pm $_ ; |
268 | } | |
269 | ||
270 | read_only_bottom_close_and_rename($pm); | |
271 | ||
c452a42f FC |
272 | |
273 | ########################################################################### | |
274 | # Generate feature.h | |
275 | ||
f2c01b15 FC |
276 | print $h <<EOH; |
277 | ||
3dd7db29 JK |
278 | #ifndef PERL_FEATURE_H_ |
279 | #define PERL_FEATURE_H_ | |
280 | ||
f2c01b15 FC |
281 | #if defined(PERL_CORE) || defined (PERL_EXT) |
282 | ||
283 | #define HINT_FEATURE_SHIFT $HintShift | |
284 | ||
f2c01b15 FC |
285 | EOH |
286 | ||
9f601cf3 TC |
287 | for (sort keys %feature_bits) { |
288 | printf $h "#define FEATURE_%s_BIT%*s %#06x\n", uc($feature{$_}), | |
289 | $width-length($feature{$_}), "", $feature_bits{$_}; | |
290 | } | |
291 | print $h "\n"; | |
292 | ||
f2c01b15 | 293 | my $count; |
016d11cb FC |
294 | for (@HintedBundles) { |
295 | (my $key = uc) =~ y/.//d; | |
296 | print $h "#define FEATURE_BUNDLE_$key ", $count++, "\n"; | |
f2c01b15 FC |
297 | } |
298 | ||
7d058bc9 | 299 | print $h <<'EOH'; |
2b9e0ab7 | 300 | #define FEATURE_BUNDLE_CUSTOM (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT) |
f2c01b15 | 301 | |
7d058bc9 | 302 | #define CURRENT_HINTS \ |
d1fd0100 | 303 | (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints) |
035b6821 FC |
304 | #define CURRENT_FEATURE_BUNDLE \ |
305 | ((CURRENT_HINTS & HINT_FEATURE_MASK) >> HINT_FEATURE_SHIFT) | |
d1fd0100 | 306 | |
9f601cf3 TC |
307 | #define FEATURE_IS_ENABLED_MASK(mask) \ |
308 | ((CURRENT_HINTS & HINT_LOCALIZE_HH) \ | |
309 | ? (PL_curcop->cop_features & (mask)) : FALSE) | |
310 | ||
7d058bc9 | 311 | /* The longest string we pass in. */ |
03222170 FC |
312 | EOH |
313 | ||
1b6e8741 FC |
314 | my $longest_internal_feature_name = longest values %feature; |
315 | print $h <<EOL; | |
316 | #define MAX_FEATURE_LEN (sizeof("$longest_internal_feature_name")-1) | |
317 | ||
318 | EOL | |
319 | ||
03222170 | 320 | for ( |
ebd25686 | 321 | sort { length $a <=> length $b || $a cmp $b } keys %feature |
03222170 FC |
322 | ) { |
323 | my($first,$last) = | |
324 | map { (my $__ = uc) =~ y/.//d; $__ } @{$BundleRanges{$_}}; | |
3fff3427 | 325 | my $name = $feature{$_}; |
03222170 | 326 | my $NAME = uc $name; |
f298f061 | 327 | if ($last && $first eq 'DEFAULT') { # '>= DEFAULT' warns |
beda0318 | 328 | print $h <<EOI; |
23fa16fc | 329 | #define FEATURE_${NAME}_IS_ENABLED \\ |
beda0318 FC |
330 | ( \\ |
331 | CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last \\ | |
332 | || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\ | |
23fa16fc | 333 | FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT)) \\ |
beda0318 FC |
334 | ) |
335 | ||
336 | EOI | |
337 | } | |
338 | elsif ($last) { | |
03222170 | 339 | print $h <<EOH3; |
23fa16fc | 340 | #define FEATURE_${NAME}_IS_ENABLED \\ |
03222170 FC |
341 | ( \\ |
342 | (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_$first && \\ | |
343 | CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last) \\ | |
344 | || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\ | |
23fa16fc | 345 | FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT)) \\ |
03222170 FC |
346 | ) |
347 | ||
348 | EOH3 | |
349 | } | |
ebd25686 | 350 | elsif ($first) { |
03222170 | 351 | print $h <<EOH4; |
23fa16fc | 352 | #define FEATURE_${NAME}_IS_ENABLED \\ |
03222170 FC |
353 | ( \\ |
354 | CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_$first \\ | |
355 | || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\ | |
23fa16fc | 356 | FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT)) \\ |
03222170 FC |
357 | ) |
358 | ||
359 | EOH4 | |
360 | } | |
ebd25686 FC |
361 | else { |
362 | print $h <<EOH5; | |
23fa16fc | 363 | #define FEATURE_${NAME}_IS_ENABLED \\ |
ebd25686 FC |
364 | ( \\ |
365 | CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\ | |
23fa16fc | 366 | FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT) \\ |
ebd25686 FC |
367 | ) |
368 | ||
369 | EOH5 | |
370 | } | |
03222170 FC |
371 | } |
372 | ||
373 | print $h <<EOH; | |
374 | ||
9f601cf3 TC |
375 | #define SAVEFEATUREBITS() SAVEI32(PL_compiling.cop_features) |
376 | ||
377 | #define CLEARFEATUREBITS() (PL_compiling.cop_features = 0) | |
378 | ||
379 | #define STOREFEATUREBITSHH(hh) \\ | |
380 | (hv_stores((hh), "feature/bits", newSVuv(PL_compiling.cop_features))) | |
381 | ||
382 | #define FETCHFEATUREBITSHH(hh) \\ | |
383 | STMT_START { \\ | |
384 | SV **fbsv = hv_fetchs((hh), "feature/bits", FALSE); \\ | |
385 | PL_compiling.cop_features = fbsv ? SvUV(*fbsv) : 0; \\ | |
386 | } STMT_END | |
387 | ||
f2c01b15 | 388 | #endif /* PERL_CORE or PERL_EXT */ |
4160ddbd FC |
389 | |
390 | #ifdef PERL_IN_OP_C | |
391 | PERL_STATIC_INLINE void | |
392 | S_enable_feature_bundle(pTHX_ SV *ver) | |
393 | { | |
394 | SV *comp_ver = sv_newmortal(); | |
395 | PL_hints = (PL_hints &~ HINT_FEATURE_MASK) | |
396 | | ( | |
f2c01b15 FC |
397 | EOH |
398 | ||
4160ddbd FC |
399 | for (reverse @HintedBundles[1..$#HintedBundles]) { # skip default |
400 | my $numver = $_; | |
401 | if ($numver eq '5.10') { $numver = '5.009005' } # special case | |
402 | else { $numver =~ s/\./.0/ } # 5.11 => 5.011 | |
403 | (my $macrover = $_) =~ y/.//d; | |
404 | print $h <<" EOK"; | |
405 | (sv_setnv(comp_ver, $numver), | |
406 | vcmp(ver, upg_version(comp_ver, FALSE)) >= 0) | |
407 | ? FEATURE_BUNDLE_$macrover : | |
408 | EOK | |
409 | } | |
410 | ||
411 | print $h <<EOJ; | |
412 | FEATURE_BUNDLE_DEFAULT | |
413 | ) << HINT_FEATURE_SHIFT; | |
6389c777 FC |
414 | /* special case */ |
415 | assert(PL_curcop == &PL_compiling); | |
416 | if (FEATURE_UNICODE_IS_ENABLED) PL_hints |= HINT_UNI_8_BIT; | |
417 | else PL_hints &= ~HINT_UNI_8_BIT; | |
4160ddbd FC |
418 | } |
419 | #endif /* PERL_IN_OP_C */ | |
3dd7db29 | 420 | |
b34c1a7e TC |
421 | #ifdef PERL_IN_MG_C |
422 | ||
423 | #define magic_sethint_feature(keysv, keypv, keylen, valsv, valbool) \\ | |
424 | S_magic_sethint_feature(aTHX_ (keysv), (keypv), (keylen), (valsv), (valbool)) | |
425 | PERL_STATIC_INLINE void | |
426 | S_magic_sethint_feature(pTHX_ SV *keysv, const char *keypv, STRLEN keylen, | |
427 | SV *valsv, bool valbool) { | |
428 | if (keysv) | |
429 | keypv = SvPV_const(keysv, keylen); | |
430 | ||
431 | if (memBEGINs(keypv, keylen, "feature_")) { | |
432 | const char *subf = keypv + (sizeof("feature_")-1); | |
433 | U32 mask = 0; | |
434 | switch (*subf) { | |
435 | EOJ | |
436 | ||
437 | my %pref; | |
438 | for my $key (sort values %feature) { | |
439 | push @{$pref{substr($key, 0, 1)}}, $key; | |
440 | } | |
441 | ||
442 | for my $pref (sort keys %pref) { | |
443 | print $h <<EOS; | |
444 | case '$pref': | |
445 | EOS | |
446 | my $first = 1; | |
447 | for my $subkey (@{$pref{$pref}}) { | |
448 | my $rest = substr($subkey, 1); | |
449 | my $if = $first ? "if" : "else if"; | |
450 | print $h <<EOJ; | |
451 | $if (keylen == sizeof("feature_$subkey")-1 | |
452 | && memcmp(subf+1, "$rest", keylen - sizeof("feature_")) == 0) { | |
453 | mask = FEATURE_\U${subkey}\E_BIT; | |
454 | break; | |
455 | } | |
456 | EOJ | |
457 | ||
458 | $first = 0; | |
459 | } | |
460 | print $h <<EOS; | |
461 | return; | |
462 | ||
463 | EOS | |
464 | } | |
465 | ||
466 | print $h <<EOJ; | |
467 | default: | |
468 | return; | |
469 | } | |
470 | if (valsv ? SvTRUE(valsv) : valbool) | |
471 | PL_compiling.cop_features |= mask; | |
472 | else | |
473 | PL_compiling.cop_features &= ~mask; | |
474 | } | |
475 | } | |
476 | #endif /* PERL_IN_MG_C */ | |
477 | ||
3dd7db29 | 478 | #endif /* PERL_FEATURE_H_ */ |
4160ddbd FC |
479 | EOJ |
480 | ||
f2c01b15 FC |
481 | read_only_bottom_close_and_rename($h); |
482 | ||
c452a42f FC |
483 | |
484 | ########################################################################### | |
485 | # Template for feature.pm | |
486 | ||
69bcf1d3 FC |
487 | __END__ |
488 | package feature; | |
489 | ||
765cd546 | 490 | our $VERSION = '1.71'; |
69bcf1d3 FC |
491 | |
492 | FEATURES | |
493 | ||
69bcf1d3 FC |
494 | # TODO: |
495 | # - think about versioned features (use feature switch => 2) | |
496 | ||
9c9853e8 KW |
497 | =encoding utf8 |
498 | ||
69bcf1d3 FC |
499 | =head1 NAME |
500 | ||
501 | feature - Perl pragma to enable new features | |
502 | ||
503 | =head1 SYNOPSIS | |
504 | ||
d15aa6ae RS |
505 | use feature qw(fc say); |
506 | ||
507 | # Without the "use feature" above, this code would not be able to find | |
508 | # the built-ins "say" or "fc": | |
509 | say "The case-folded version of $x is: " . fc $x; | |
510 | ||
511 | ||
512 | # set features to match the :5.10 bundle, which may turn off or on | |
513 | # multiple features (see below) | |
514 | use feature ':5.10'; | |
69bcf1d3 | 515 | |
69bcf1d3 | 516 | |
d15aa6ae RS |
517 | # implicitly loads :5.10 feature bundle |
518 | use v5.10; | |
69bcf1d3 FC |
519 | |
520 | =head1 DESCRIPTION | |
521 | ||
522 | It is usually impossible to add new syntax to Perl without breaking | |
523 | some existing programs. This pragma provides a way to minimize that | |
524 | risk. New syntactic constructs, or new semantic meanings to older | |
525 | constructs, can be enabled by C<use feature 'foo'>, and will be parsed | |
526 | only when the appropriate feature pragma is in scope. (Nevertheless, the | |
527 | C<CORE::> prefix provides access to all Perl keywords, regardless of this | |
528 | pragma.) | |
529 | ||
530 | =head2 Lexical effect | |
531 | ||
532 | Like other pragmas (C<use strict>, for example), features have a lexical | |
301381dc | 533 | effect. C<use feature qw(foo)> will only make the feature "foo" available |
69bcf1d3 FC |
534 | from that point to the end of the enclosing block. |
535 | ||
536 | { | |
537 | use feature 'say'; | |
538 | say "say is available here"; | |
539 | } | |
540 | print "But not here.\n"; | |
541 | ||
542 | =head2 C<no feature> | |
543 | ||
544 | Features can also be turned off by using C<no feature "foo">. This too | |
545 | has lexical effect. | |
546 | ||
547 | use feature 'say'; | |
548 | say "say is available here"; | |
549 | { | |
550 | no feature 'say'; | |
551 | print "But not here.\n"; | |
552 | } | |
553 | say "Yet it is here."; | |
554 | ||
39ec54a5 RS |
555 | C<no feature> with no features specified will reset to the default group. To |
556 | disable I<all> features (an unusual request!) use C<no feature ':all'>. | |
69bcf1d3 FC |
557 | |
558 | =head1 AVAILABLE FEATURES | |
559 | ||
560 | =head2 The 'say' feature | |
561 | ||
5d6cc146 | 562 | C<use feature 'say'> tells the compiler to enable the Raku-inspired |
69bcf1d3 FC |
563 | C<say> function. |
564 | ||
565 | See L<perlfunc/say> for details. | |
566 | ||
567 | This feature is available starting with Perl 5.10. | |
568 | ||
569 | =head2 The 'state' feature | |
570 | ||
571 | C<use feature 'state'> tells the compiler to enable C<state> | |
572 | variables. | |
573 | ||
574 | See L<perlsub/"Persistent Private Variables"> for details. | |
575 | ||
576 | This feature is available starting with Perl 5.10. | |
577 | ||
578 | =head2 The 'switch' feature | |
579 | ||
d23c9e49 RS |
580 | B<WARNING>: This feature is still experimental and the implementation may |
581 | change or be removed in future versions of Perl. For this reason, Perl will | |
582 | warn when you use the feature, unless you have explicitly disabled the warning: | |
7caca87c DB |
583 | |
584 | no warnings "experimental::smartmatch"; | |
585 | ||
5d6cc146 | 586 | C<use feature 'switch'> tells the compiler to enable the Raku |
69bcf1d3 FC |
587 | given/when construct. |
588 | ||
48238296 | 589 | See L<perlsyn/"Switch Statements"> for details. |
69bcf1d3 FC |
590 | |
591 | This feature is available starting with Perl 5.10. | |
592 | ||
593 | =head2 The 'unicode_strings' feature | |
594 | ||
850b7ec9 | 595 | C<use feature 'unicode_strings'> tells the compiler to use Unicode rules |
69bcf1d3 FC |
596 | in all string operations executed within its scope (unless they are also |
597 | within the scope of either C<use locale> or C<use bytes>). The same applies | |
598 | to all regular expressions compiled within the scope, even if executed outside | |
2269d15c KW |
599 | it. It does not change the internal representation of strings, but only how |
600 | they are interpreted. | |
69bcf1d3 FC |
601 | |
602 | C<no feature 'unicode_strings'> tells the compiler to use the traditional | |
850b7ec9 | 603 | Perl rules wherein the native character set rules is used unless it is |
69bcf1d3 FC |
604 | clear to Perl that Unicode is desired. This can lead to some surprises |
605 | when the behavior suddenly changes. (See | |
606 | L<perlunicode/The "Unicode Bug"> for details.) For this reason, if you are | |
607 | potentially using Unicode in your program, the | |
608 | C<use feature 'unicode_strings'> subpragma is B<strongly> recommended. | |
609 | ||
2e2b2571 | 610 | This feature is available starting with Perl 5.12; was almost fully |
d6c970c7 | 611 | implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>; |
20ae58f7 AC |
612 | was extended further in Perl 5.26 to cover L<the range |
613 | operator|perlop/Range Operators>; and was extended again in Perl 5.28 to | |
614 | cover L<special-cased whitespace splitting|perlfunc/split>. | |
69bcf1d3 FC |
615 | |
616 | =head2 The 'unicode_eval' and 'evalbytes' features | |
617 | ||
9891e9b7 KW |
618 | Together, these two features are intended to replace the legacy string |
619 | C<eval> function, which behaves problematically in some instances. They are | |
620 | available starting with Perl 5.16, and are enabled by default by a | |
621 | S<C<use 5.16>> or higher declaration. | |
622 | ||
623 | C<unicode_eval> changes the behavior of plain string C<eval> to work more | |
624 | consistently, especially in the Unicode world. Certain (mis)behaviors | |
625 | couldn't be changed without breaking some things that had come to rely on | |
626 | them, so the feature can be enabled and disabled. Details are at | |
627 | L<perlfunc/Under the "unicode_eval" feature>. | |
628 | ||
e6f2f64a FG |
629 | C<evalbytes> is like string C<eval>, but it treats its argument as a byte |
630 | string. Details are at L<perlfunc/evalbytes EXPR>. Without a | |
9891e9b7 KW |
631 | S<C<use feature 'evalbytes'>> nor a S<C<use v5.16>> (or higher) declaration in |
632 | the current scope, you can still access it by instead writing | |
633 | C<CORE::evalbytes>. | |
69bcf1d3 FC |
634 | |
635 | =head2 The 'current_sub' feature | |
636 | ||
637 | This provides the C<__SUB__> token that returns a reference to the current | |
638 | subroutine or C<undef> outside of a subroutine. | |
639 | ||
640 | This feature is available starting with Perl 5.16. | |
641 | ||
642 | =head2 The 'array_base' feature | |
643 | ||
c22e17d0 DIM |
644 | This feature supported the legacy C<$[> variable. See L<perlvar/$[>. |
645 | It was on by default but disabled under C<use v5.16> (see | |
646 | L</IMPLICIT LOADING>, below) and unavailable since perl 5.30. | |
69bcf1d3 FC |
647 | |
648 | This feature is available under this name starting with Perl 5.16. In | |
649 | previous versions, it was simply on all the time, and this pragma knew | |
650 | nothing about it. | |
651 | ||
2a4315f8 BF |
652 | =head2 The 'fc' feature |
653 | ||
654 | C<use feature 'fc'> tells the compiler to enable the C<fc> function, | |
655 | which implements Unicode casefolding. | |
656 | ||
657 | See L<perlfunc/fc> for details. | |
658 | ||
659 | This feature is available from Perl 5.16 onwards. | |
660 | ||
ca40957e FC |
661 | =head2 The 'lexical_subs' feature |
662 | ||
8f7d85af FC |
663 | In Perl versions prior to 5.26, this feature enabled |
664 | declaration of subroutines via C<my sub foo>, C<state sub foo> | |
665 | and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details. | |
ca40957e | 666 | |
8f7d85af FC |
667 | This feature is available from Perl 5.18 onwards. From Perl 5.18 to 5.24, |
668 | it was classed as experimental, and Perl emitted a warning for its | |
669 | usage, except when explicitly disabled: | |
ca40957e | 670 | |
8f7d85af | 671 | no warnings "experimental::lexical_subs"; |
ca40957e | 672 | |
8f7d85af FC |
673 | As of Perl 5.26, use of this feature no longer triggers a warning, though |
674 | the C<experimental::lexical_subs> warning category still exists (for | |
675 | compatibility with code that disables it). In addition, this syntax is | |
676 | not only no longer experimental, but it is enabled for all Perl code, | |
677 | regardless of what feature declarations are in scope. | |
ca40957e | 678 | |
f86d720e RS |
679 | =head2 The 'postderef' and 'postderef_qq' features |
680 | ||
1c2511e0 AC |
681 | The 'postderef_qq' feature extends the applicability of L<postfix |
682 | dereference syntax|perlref/Postfix Dereference Syntax> so that postfix array | |
683 | and scalar dereference are available in double-quotish interpolations. For | |
684 | example, it makes the following two statements equivalent: | |
f86d720e | 685 | |
1c2511e0 AC |
686 | my $s = "[@{ $h->{a} }]"; |
687 | my $s = "[$h->{a}->@*]"; | |
f86d720e | 688 | |
1c2511e0 AC |
689 | This feature is available from Perl 5.20 onwards. In Perl 5.20 and 5.22, it |
690 | was classed as experimental, and Perl emitted a warning for its | |
2ad792cd AC |
691 | usage, except when explicitly disabled: |
692 | ||
693 | no warnings "experimental::postderef"; | |
694 | ||
1c2511e0 | 695 | As of Perl 5.24, use of this feature no longer triggers a warning, though |
2ad792cd AC |
696 | the C<experimental::postderef> warning category still exists (for |
697 | compatibility with code that disables it). | |
f86d720e | 698 | |
1c2511e0 AC |
699 | The 'postderef' feature was used in Perl 5.20 and Perl 5.22 to enable |
700 | postfix dereference syntax outside double-quotish interpolations. In those | |
701 | versions, using it triggered the C<experimental::postderef> warning in the | |
702 | same way as the 'postderef_qq' feature did. As of Perl 5.24, this syntax is | |
703 | not only no longer experimental, but it is enabled for all Perl code, | |
704 | regardless of what feature declarations are in scope. | |
705 | ||
30d9c59b Z |
706 | =head2 The 'signatures' feature |
707 | ||
3d1a4f06 | 708 | This enables syntax for declaring subroutine arguments as lexical variables. |
765cd546 | 709 | For example, for this subroutine: |
30d9c59b Z |
710 | |
711 | sub foo ($left, $right) { | |
3d1a4f06 | 712 | return $left + $right; |
30d9c59b Z |
713 | } |
714 | ||
3d1a4f06 PE |
715 | Calling C<foo(3, 7)> will assign C<3> into C<$left> and C<7> into C<$right>. |
716 | ||
30d9c59b Z |
717 | See L<perlsub/Signatures> for details. |
718 | ||
088588be PE |
719 | This feature is available from Perl 5.20 onwards. From Perl 5.20 to 5.34, |
720 | it was classed as experimental, and Perl emitted a warning for its usage, | |
721 | except when explicitly disabled: | |
722 | ||
723 | no warnings "experimental::signatures"; | |
724 | ||
725 | As of Perl 5.36, use of this feature no longer triggers a warning, though the | |
726 | C<experimental::signatures> warning category still exists (for compatibility | |
3d1a4f06 PE |
727 | with code that disables it). This feature is now considered stable, and is |
728 | enabled automatically by C<use v5.36> (or higher). | |
30d9c59b | 729 | |
baabe3fb | 730 | =head2 The 'refaliasing' feature |
82848c10 FC |
731 | |
732 | B<WARNING>: This feature is still experimental and the implementation may | |
d23c9e49 RS |
733 | change or be removed in future versions of Perl. For this reason, Perl will |
734 | warn when you use the feature, unless you have explicitly disabled the warning: | |
82848c10 | 735 | |
baabe3fb | 736 | no warnings "experimental::refaliasing"; |
82848c10 FC |
737 | |
738 | This enables aliasing via assignment to references: | |
739 | ||
740 | \$a = \$b; # $a and $b now point to the same scalar | |
741 | \@a = \@b; # to the same array | |
742 | \%a = \%b; | |
743 | \&a = \&b; | |
744 | foreach \%hash (@array_of_hash_refs) { | |
745 | ... | |
746 | } | |
747 | ||
748 | See L<perlref/Assigning to References> for details. | |
749 | ||
750 | This feature is available from Perl 5.22 onwards. | |
751 | ||
70ea8edf FC |
752 | =head2 The 'bitwise' feature |
753 | ||
70ea8edf FC |
754 | This makes the four standard bitwise operators (C<& | ^ ~>) treat their |
755 | operands consistently as numbers, and introduces four new dotted operators | |
756 | (C<&. |. ^. ~.>) that treat their operands consistently as strings. The | |
757 | same applies to the assignment variants (C<&= |= ^= &.= |.= ^.=>). | |
758 | ||
759 | See L<perlop/Bitwise String Operators> for details. | |
760 | ||
193789ac FC |
761 | This feature is available from Perl 5.22 onwards. Starting in Perl 5.28, |
762 | C<use v5.28> will enable the feature. Before 5.28, it was still | |
763 | experimental and would emit a warning in the "experimental::bitwise" | |
764 | category. | |
70ea8edf | 765 | |
5c703779 FC |
766 | =head2 The 'declared_refs' feature |
767 | ||
768 | B<WARNING>: This feature is still experimental and the implementation may | |
d23c9e49 RS |
769 | change or be removed in future versions of Perl. For this reason, Perl will |
770 | warn when you use the feature, unless you have explicitly disabled the warning: | |
5c703779 FC |
771 | |
772 | no warnings "experimental::declared_refs"; | |
773 | ||
774 | This allows a reference to a variable to be declared with C<my>, C<state>, | |
775 | our C<our>, or localized with C<local>. It is intended mainly for use in | |
776 | conjunction with the "refaliasing" feature. See L<perlref/Declaring a | |
777 | Reference to a Variable> for examples. | |
778 | ||
779 | This feature is available from Perl 5.26 onwards. | |
780 | ||
813e85a0 PE |
781 | =head2 The 'isa' feature |
782 | ||
783 | This allows the use of the C<isa> infix operator, which tests whether the | |
784 | scalar given by the left operand is an object of the class given by the | |
785 | right operand. See L<perlop/Class Instance Operator> for more details. | |
786 | ||
157bd0a3 PE |
787 | This feature is available from Perl 5.32 onwards. From Perl 5.32 to 5.34, |
788 | it was classed as experimental, and Perl emitted a warning for its usage, | |
789 | except when explicitly disabled: | |
790 | ||
791 | no warnings "experimental::isa"; | |
792 | ||
793 | As of Perl 5.36, use of this feature no longer triggers a warning (though the | |
794 | C<experimental::isa> warning category stilll exists for compatibility with | |
02547a38 PE |
795 | code that disables it). This feature is now considered stable, and is enabled |
796 | automatically by C<use v5.36> (or higher). | |
813e85a0 | 797 | |
0b657b19 DIM |
798 | =head2 The 'indirect' feature |
799 | ||
800 | This feature allows the use of L<indirect object | |
801 | syntax|perlobj/Indirect Object Syntax> for method calls, e.g. C<new | |
802 | Foo 1, 2;>. It is enabled by default, but can be turned off to | |
803 | disallow indirect object syntax. | |
804 | ||
805 | This feature is available under this name from Perl 5.32 onwards. In | |
806 | previous versions, it was simply on all the time. To disallow (or | |
807 | warn on) indirect object syntax on older Perls, see the L<indirect> | |
808 | CPAN module. | |
809 | ||
1ad5a39c TC |
810 | =head2 The 'multidimensional' feature |
811 | ||
812 | This feature enables multidimensional array emulation, a perl 4 (or | |
813 | earlier) feature that was used to emulate multidimensional arrays with | |
c7888de9 EAV |
814 | hashes. This works by converting code like C<< $foo{$x, $y} >> into |
815 | C<< $foo{join($;, $x, $y)} >>. It is enabled by default, but can be | |
1ad5a39c TC |
816 | turned off to disable multidimensional array emulation. |
817 | ||
818 | When this feature is disabled the syntax that is normally replaced | |
819 | will report a compilation error. | |
820 | ||
821 | This feature is available under this name from Perl 5.34 onwards. In | |
822 | previous versions, it was simply on all the time. | |
823 | ||
824 | You can use the L<multidimensional> module on CPAN to disable | |
825 | multidimensional array emulation for older versions of Perl. | |
826 | ||
0f2beabb TC |
827 | =head2 The 'bareword_filehandles' feature. |
828 | ||
829 | This feature enables bareword filehandles for builtin functions | |
830 | operations, a generally discouraged practice. It is enabled by | |
831 | default, but can be turned off to disable bareword filehandles, except | |
832 | for the exceptions listed below. | |
833 | ||
834 | The perl built-in filehandles C<STDIN>, C<STDOUT>, C<STDERR>, C<DATA>, | |
835 | C<ARGV>, C<ARGVOUT> and the special C<_> are always enabled. | |
836 | ||
d5c835da RS |
837 | This behavior was always present in versions before Perl 5.34. In Perl 5.34, |
838 | it was made controllable with the C<feature> pragma, but was on by default. | |
839 | It is not present in the C<:5.36> feature bundle, so C<use v5.36> disables | |
840 | this feature. | |
0f2beabb TC |
841 | |
842 | You can use the L<bareword::filehandles> module on CPAN to disable | |
843 | bareword filehandles for older versions of perl. | |
844 | ||
a1325b90 PE |
845 | =head2 The 'try' feature. |
846 | ||
35b06c4c RS |
847 | B<WARNING>: This feature is still experimental and the implementation may |
848 | change or be removed in future versions of Perl. For this reason, Perl will | |
849 | warn when you use the feature, unless you have explicitly disabled the warning: | |
850 | ||
851 | no warnings "experimental::try"; | |
852 | ||
a1325b90 | 853 | This feature enables the C<try> and C<catch> syntax, which allows exception |
4a485c3e | 854 | handling, where exceptions thrown from the body of the block introduced with |
a1325b90 PE |
855 | C<try> are caught by executing the body of the C<catch> block. |
856 | ||
857 | For more information, see L<perlsyn/"Try Catch Exception Handling">. | |
858 | ||
f79e2ff9 PE |
859 | =head2 The 'defer' feature |
860 | ||
861 | This feature enables the C<defer> block syntax, which allows a block of code | |
862 | to be deferred until when the flow of control leaves the block which contained | |
863 | it. For more details, see L<perlsyn/defer>. | |
864 | ||
9c9853e8 KW |
865 | =head2 The 'extra_paired_delimiters' feature |
866 | ||
867 | B<WARNING>: This feature is still experimental and the implementation may | |
868 | change or be removed in future versions of Perl. For this reason, Perl will | |
869 | warn when you use the feature, unless you have explicitly disabled the warning: | |
870 | ||
871 | no warnings "experimental::extra_paired_delimiters"; | |
872 | ||
873 | This feature enables the use of more paired string delimiters than the | |
874 | traditional four, S<C<< < > >>>, S<C<( )>>, S<C<{ }>>, and S<C<[ ]>>. When | |
875 | this feature is on, for example, you can say S<C<qrE<171>patE<187>>>. | |
876 | ||
877 | This feature is available starting in Perl 5.36. | |
878 | ||
879 | The complete list of accepted paired delimiters as of Unicode 14.0 is: | |
880 | ||
881 | ( ) U+0028, U+0029 LEFT/RIGHT PARENTHESIS | |
7e4a71c6 | 882 | < > U+003C, U+003E LESS-THAN/GREATER-THAN SIGN |
9c9853e8 KW |
883 | [ ] U+005B, U+005D LEFT/RIGHT SQUARE BRACKET |
884 | { } U+007B, U+007D LEFT/RIGHT CURLY BRACKET | |
885 | « » U+00AB, U+00BB LEFT/RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK | |
835f2666 | 886 | » « U+00BB, U+00AB RIGHT/LEFT-POINTING DOUBLE ANGLE QUOTATION MARK |
210ad843 | 887 | ܆ ܇ U+0706, U+0707 SYRIAC COLON SKEWED LEFT/RIGHT |
9c9853e8 KW |
888 | ༺ ༻ U+0F3A, U+0F3B TIBETAN MARK GUG RTAGS GYON, TIBETAN MARK GUG |
889 | RTAGS GYAS | |
890 | ༼ ༽ U+0F3C, U+0F3D TIBETAN MARK ANG KHANG GYON, TIBETAN MARK ANG | |
891 | KHANG GYAS | |
892 | ᚛ ᚜ U+169B, U+169C OGHAM FEATHER MARK, OGHAM REVERSED FEATHER MARK | |
1df06fae KW |
893 | ‘ ’ U+2018, U+2019 LEFT/RIGHT SINGLE QUOTATION MARK |
894 | ’ ‘ U+2019, U+2018 RIGHT/LEFT SINGLE QUOTATION MARK | |
895 | “ ” U+201C, U+201D LEFT/RIGHT DOUBLE QUOTATION MARK | |
896 | ” “ U+201D, U+201C RIGHT/LEFT DOUBLE QUOTATION MARK | |
210ad843 KW |
897 | ‵ ′ U+2035, U+2032 REVERSED PRIME, PRIME |
898 | ‶ ″ U+2036, U+2033 REVERSED DOUBLE PRIME, DOUBLE PRIME | |
899 | ‷ ‴ U+2037, U+2034 REVERSED TRIPLE PRIME, TRIPLE PRIME | |
9c9853e8 | 900 | ‹ › U+2039, U+203A SINGLE LEFT/RIGHT-POINTING ANGLE QUOTATION MARK |
835f2666 | 901 | › ‹ U+203A, U+2039 SINGLE RIGHT/LEFT-POINTING ANGLE QUOTATION MARK |
9c9853e8 | 902 | ⁅ ⁆ U+2045, U+2046 LEFT/RIGHT SQUARE BRACKET WITH QUILL |
50b17915 | 903 | ⁍ ⁌ U+204D, U+204C BLACK RIGHT/LEFTWARDS BULLET |
9c9853e8 KW |
904 | ⁽ ⁾ U+207D, U+207E SUPERSCRIPT LEFT/RIGHT PARENTHESIS |
905 | ₍ ₎ U+208D, U+208E SUBSCRIPT LEFT/RIGHT PARENTHESIS | |
0b6e3da1 KW |
906 | → ← U+2192, U+2190 RIGHT/LEFTWARDS ARROW |
907 | ↛ ↚ U+219B, U+219A RIGHT/LEFTWARDS ARROW WITH STROKE | |
908 | ↝ ↜ U+219D, U+219C RIGHT/LEFTWARDS WAVE ARROW | |
909 | ↠ ↞ U+21A0, U+219E RIGHT/LEFTWARDS TWO HEADED ARROW | |
910 | ↣ ↢ U+21A3, U+21A2 RIGHT/LEFTWARDS ARROW WITH TAIL | |
911 | ↦ ↤ U+21A6, U+21A4 RIGHT/LEFTWARDS ARROW FROM BAR | |
912 | ↪ ↩ U+21AA, U+21A9 RIGHT/LEFTWARDS ARROW WITH HOOK | |
913 | ↬ ↫ U+21AC, U+21AB RIGHT/LEFTWARDS ARROW WITH LOOP | |
914 | ↱ ↰ U+21B1, U+21B0 UPWARDS ARROW WITH TIP RIGHT/LEFTWARDS | |
915 | ↳ ↲ U+21B3, U+21B2 DOWNWARDS ARROW WITH TIP RIGHT/LEFTWARDS | |
916 | ⇀ ↼ U+21C0, U+21BC RIGHT/LEFTWARDS HARPOON WITH BARB UPWARDS | |
917 | ⇁ ↽ U+21C1, U+21BD RIGHT/LEFTWARDS HARPOON WITH BARB DOWNWARDS | |
918 | ⇉ ⇇ U+21C9, U+21C7 RIGHT/LEFTWARDS PAIRED ARROWS | |
919 | ⇏ ⇍ U+21CF, U+21CD RIGHT/LEFTWARDS DOUBLE ARROW WITH STROKE | |
920 | ⇒ ⇐ U+21D2, U+21D0 RIGHT/LEFTWARDS DOUBLE ARROW | |
921 | ⇛ ⇚ U+21DB, U+21DA RIGHT/LEFTWARDS TRIPLE ARROW | |
922 | ⇝ ⇜ U+21DD, U+21DC RIGHT/LEFTWARDS SQUIGGLE ARROW | |
923 | ⇢ ⇠ U+21E2, U+21E0 RIGHT/LEFTWARDS DASHED ARROW | |
924 | ⇥ ⇤ U+21E5, U+21E4 RIGHT/LEFTWARDS ARROW TO BAR | |
925 | ⇨ ⇦ U+21E8, U+21E6 RIGHT/LEFTWARDS WHITE ARROW | |
926 | ⇴ ⬰ U+21F4, U+2B30 RIGHT/LEFT ARROW WITH SMALL CIRCLE | |
927 | ⇶ ⬱ U+21F6, U+2B31 THREE RIGHT/LEFTWARDS ARROWS | |
928 | ⇸ ⇷ U+21F8, U+21F7 RIGHT/LEFTWARDS ARROW WITH VERTICAL STROKE | |
929 | ⇻ ⇺ U+21FB, U+21FA RIGHT/LEFTWARDS ARROW WITH DOUBLE VERTICAL | |
930 | STROKE | |
931 | ⇾ ⇽ U+21FE, U+21FD RIGHT/LEFTWARDS OPEN-HEADED ARROW | |
c1b67e77 KW |
932 | ∈ ∋ U+2208, U+220B ELEMENT OF, CONTAINS AS MEMBER |
933 | ∉ ∌ U+2209, U+220C NOT AN ELEMENT OF, DOES NOT CONTAIN AS MEMBER | |
934 | ∊ ∍ U+220A, U+220D SMALL ELEMENT OF, SMALL CONTAINS AS MEMBER | |
7e4a71c6 KW |
935 | ≤ ≥ U+2264, U+2265 LESS-THAN/GREATER-THAN OR EQUAL TO |
936 | ≦ ≧ U+2266, U+2267 LESS-THAN/GREATER-THAN OVER EQUAL TO | |
937 | ≨ ≩ U+2268, U+2269 LESS-THAN/GREATER-THAN BUT NOT EQUAL TO | |
938 | ≪ ≫ U+226A, U+226B MUCH LESS-THAN/GREATER-THAN | |
939 | ≮ ≯ U+226E, U+226F NOT LESS-THAN/GREATER-THAN | |
940 | ≰ ≱ U+2270, U+2271 NEITHER LESS-THAN/GREATER-THAN NOR EQUAL TO | |
941 | ≲ ≳ U+2272, U+2273 LESS-THAN/GREATER-THAN OR EQUIVALENT TO | |
942 | ≴ ≵ U+2274, U+2275 NEITHER LESS-THAN/GREATER-THAN NOR EQUIVALENT TO | |
6763e244 KW |
943 | ≺ ≻ U+227A, U+227B PRECEDES/SUCCEEDS |
944 | ≼ ≽ U+227C, U+227D PRECEDES/SUCCEEDS OR EQUAL TO | |
945 | ≾ ≿ U+227E, U+227F PRECEDES/SUCCEEDS OR EQUIVALENT TO | |
946 | ⊀ ⊁ U+2280, U+2281 DOES NOT PRECEDE/SUCCEED | |
0a4ec1c0 KW |
947 | ⊂ ⊃ U+2282, U+2283 SUBSET/SUPERSET OF |
948 | ⊄ ⊅ U+2284, U+2285 NOT A SUBSET/SUPERSET OF | |
949 | ⊆ ⊇ U+2286, U+2287 SUBSET/SUPERSET OF OR EQUAL TO | |
950 | ⊈ ⊉ U+2288, U+2289 NEITHER A SUBSET/SUPERSET OF NOR EQUAL TO | |
951 | ⊊ ⊋ U+228A, U+228B SUBSET/SUPERSET OF WITH NOT EQUAL TO | |
c7c4369b KW |
952 | ⊣ ⊢ U+22A3, U+22A2 LEFT/RIGHT TACK |
953 | ⊦ ⫞ U+22A6, U+2ADE ASSERTION, SHORT LEFT TACK | |
84c1ecba KW |
954 | ⊨ ⫤ U+22A8, U+2AE4 TRUE, VERTICAL BAR DOUBLE LEFT TURNSTILE |
955 | ⊩ ⫣ U+22A9, U+2AE3 FORCES, DOUBLE VERTICAL BAR LEFT TURNSTILE | |
6763e244 | 956 | ⊰ ⊱ U+22B0, U+22B1 PRECEDES/SUCCEEDS UNDER RELATION |
0a4ec1c0 | 957 | ⋐ ⋑ U+22D0, U+22D1 DOUBLE SUBSET/SUPERSET |
7e4a71c6 KW |
958 | ⋖ ⋗ U+22D6, U+22D7 LESS-THAN/GREATER-THAN WITH DOT |
959 | ⋘ ⋙ U+22D8, U+22D9 VERY MUCH LESS-THAN/GREATER-THAN | |
960 | ⋜ ⋝ U+22DC, U+22DD EQUAL TO OR LESS-THAN/GREATER-THAN | |
6763e244 KW |
961 | ⋞ ⋟ U+22DE, U+22DF EQUAL TO OR PRECEDES/SUCCEEDS |
962 | ⋠ ⋡ U+22E0, U+22E1 DOES NOT PRECEDE/SUCCEED OR EQUAL | |
7e4a71c6 | 963 | ⋦ ⋧ U+22E6, U+22E7 LESS-THAN/GREATER-THAN BUT NOT EQUIVALENT TO |
6763e244 | 964 | ⋨ ⋩ U+22E8, U+22E9 PRECEDES/SUCCEEDS BUT NOT EQUIVALENT TO |
c1b67e77 KW |
965 | ⋲ ⋺ U+22F2, U+22FA ELEMENT OF/CONTAINS WITH LONG HORIZONTAL STROKE |
966 | ⋳ ⋻ U+22F3, U+22FB ELEMENT OF/CONTAINS WITH VERTICAL BAR AT END OF | |
967 | HORIZONTAL STROKE | |
968 | ⋴ ⋼ U+22F4, U+22FC SMALL ELEMENT OF/CONTAINS WITH VERTICAL BAR AT | |
969 | END OF HORIZONTAL STROKE | |
970 | ⋶ ⋽ U+22F6, U+22FD ELEMENT OF/CONTAINS WITH OVERBAR | |
971 | ⋷ ⋾ U+22F7, U+22FE SMALL ELEMENT OF/CONTAINS WITH OVERBAR | |
9c9853e8 KW |
972 | ⌈ ⌉ U+2308, U+2309 LEFT/RIGHT CEILING |
973 | ⌊ ⌋ U+230A, U+230B LEFT/RIGHT FLOOR | |
806eaaf9 | 974 | ⌦ ⌫ U+2326, U+232B ERASE TO THE RIGHT/LEFT |
9c9853e8 | 975 | 〈 〉 U+2329, U+232A LEFT/RIGHT-POINTING ANGLE BRACKET |
0b6e3da1 | 976 | ⍈ ⍇ U+2348, U+2347 APL FUNCTIONAL SYMBOL QUAD RIGHT/LEFTWARDS ARROW |
a29825fb KW |
977 | ⏩ ⏪ U+23E9, U+23EA BLACK RIGHT/LEFT-POINTING DOUBLE TRIANGLE |
978 | ⏭ ⏮ U+23ED, U+23EE BLACK RIGHT/LEFT-POINTING DOUBLE TRIANGLE WITH | |
979 | VERTICAL BAR | |
4a4b7455 KW |
980 | ☛ ☚ U+261B, U+261A BLACK RIGHT/LEFT POINTING INDEX |
981 | ☞ ☜ U+261E, U+261C WHITE RIGHT/LEFT POINTING INDEX | |
3e9e4fd8 | 982 | ⚞ ⚟ U+269E, U+269F THREE LINES CONVERGING RIGHT/LEFT |
9c9853e8 KW |
983 | ❨ ❩ U+2768, U+2769 MEDIUM LEFT/RIGHT PARENTHESIS ORNAMENT |
984 | ❪ ❫ U+276A, U+276B MEDIUM FLATTENED LEFT/RIGHT PARENTHESIS ORNAMENT | |
985 | ❬ ❭ U+276C, U+276D MEDIUM LEFT/RIGHT-POINTING ANGLE BRACKET | |
986 | ORNAMENT | |
987 | ❮ ❯ U+276E, U+276F HEAVY LEFT/RIGHT-POINTING ANGLE QUOTATION MARK | |
988 | ORNAMENT | |
989 | ❰ ❱ U+2770, U+2771 HEAVY LEFT/RIGHT-POINTING ANGLE BRACKET ORNAMENT | |
990 | ❲ ❳ U+2772, U+2773 LIGHT LEFT/RIGHT TORTOISE SHELL BRACKET ORNAMENT | |
991 | ❴ ❵ U+2774, U+2775 MEDIUM LEFT/RIGHT CURLY BRACKET ORNAMENT | |
0a4ec1c0 | 992 | ⟃ ⟄ U+27C3, U+27C4 OPEN SUBSET/SUPERSET |
9c9853e8 | 993 | ⟅ ⟆ U+27C5, U+27C6 LEFT/RIGHT S-SHAPED BAG DELIMITER |
0a4ec1c0 KW |
994 | ⟈ ⟉ U+27C8, U+27C9 REVERSE SOLIDUS PRECEDING SUBSET, SUPERSET |
995 | PRECEDING SOLIDUS | |
c7c4369b | 996 | ⟞ ⟝ U+27DE, U+27DD LONG LEFT/RIGHT TACK |
9c9853e8 KW |
997 | ⟦ ⟧ U+27E6, U+27E7 MATHEMATICAL LEFT/RIGHT WHITE SQUARE BRACKET |
998 | ⟨ ⟩ U+27E8, U+27E9 MATHEMATICAL LEFT/RIGHT ANGLE BRACKET | |
999 | ⟪ ⟫ U+27EA, U+27EB MATHEMATICAL LEFT/RIGHT DOUBLE ANGLE BRACKET | |
1000 | ⟬ ⟭ U+27EC, U+27ED MATHEMATICAL LEFT/RIGHT WHITE TORTOISE SHELL | |
1001 | BRACKET | |
1002 | ⟮ ⟯ U+27EE, U+27EF MATHEMATICAL LEFT/RIGHT FLATTENED PARENTHESIS | |
0b6e3da1 KW |
1003 | ⟴ ⬲ U+27F4, U+2B32 RIGHT/LEFT ARROW WITH CIRCLED PLUS |
1004 | ⟶ ⟵ U+27F6, U+27F5 LONG RIGHT/LEFTWARDS ARROW | |
1005 | ⟹ ⟸ U+27F9, U+27F8 LONG RIGHT/LEFTWARDS DOUBLE ARROW | |
1006 | ⟼ ⟻ U+27FC, U+27FB LONG RIGHT/LEFTWARDS ARROW FROM BAR | |
1007 | ⟾ ⟽ U+27FE, U+27FD LONG RIGHT/LEFTWARDS DOUBLE ARROW FROM BAR | |
1008 | ⟿ ⬳ U+27FF, U+2B33 LONG RIGHT/LEFTWARDS SQUIGGLE ARROW | |
1009 | ⤀ ⬴ U+2900, U+2B34 RIGHT/LEFTWARDS TWO-HEADED ARROW WITH VERTICAL | |
1010 | STROKE | |
1011 | ⤁ ⬵ U+2901, U+2B35 RIGHT/LEFTWARDS TWO-HEADED ARROW WITH DOUBLE | |
1012 | VERTICAL STROKE | |
1013 | ⤃ ⤂ U+2903, U+2902 RIGHT/LEFTWARDS DOUBLE ARROW WITH VERTICAL | |
1014 | STROKE | |
1015 | ⤅ ⬶ U+2905, U+2B36 RIGHT/LEFTWARDS TWO-HEADED ARROW FROM BAR | |
1016 | ⤇ ⤆ U+2907, U+2906 RIGHT/LEFTWARDS DOUBLE ARROW FROM BAR | |
1017 | ⤍ ⤌ U+290D, U+290C RIGHT/LEFTWARDS DOUBLE DASH ARROW | |
1018 | ⤏ ⤎ U+290F, U+290E RIGHT/LEFTWARDS TRIPLE DASH ARROW | |
1019 | ⤐ ⬷ U+2910, U+2B37 RIGHT/LEFTWARDS TWO-HEADED TRIPLE DASH ARROW | |
1020 | ⤑ ⬸ U+2911, U+2B38 RIGHT/LEFTWARDS ARROW WITH DOTTED STEM | |
1021 | ⤔ ⬹ U+2914, U+2B39 RIGHT/LEFTWARDS ARROW WITH TAIL WITH VERTICAL | |
1022 | STROKE | |
1023 | ⤕ ⬺ U+2915, U+2B3A RIGHT/LEFTWARDS ARROW WITH TAIL WITH DOUBLE | |
1024 | VERTICAL STROKE | |
1025 | ⤖ ⬻ U+2916, U+2B3B RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TAIL | |
1026 | ⤗ ⬼ U+2917, U+2B3C RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH | |
1027 | VERTICAL STROKE | |
1028 | ⤘ ⬽ U+2918, U+2B3D RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH | |
1029 | DOUBLE VERTICAL STROKE | |
1030 | ⤚ ⤙ U+291A, U+2919 RIGHT/LEFTWARDS ARROW-TAIL | |
1031 | ⤜ ⤛ U+291C, U+291B RIGHT/LEFTWARDS DOUBLE ARROW-TAIL | |
1032 | ⤞ ⤝ U+291E, U+291D RIGHT/LEFTWARDS ARROW TO BLACK DIAMOND | |
1033 | ⤠ ⤟ U+2920, U+291F RIGHT/LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND | |
1034 | ⤳ ⬿ U+2933, U+2B3F WAVE ARROW POINTING DIRECTLY RIGHT/LEFT | |
1035 | ⤷ ⤶ U+2937, U+2936 ARROW POINTING DOWNWARDS THEN CURVING RIGHT/ | |
1036 | LEFTWARDS | |
1037 | ⥅ ⥆ U+2945, U+2946 RIGHT/LEFTWARDS ARROW WITH PLUS BELOW | |
1038 | ⥇ ⬾ U+2947, U+2B3E RIGHT/LEFTWARDS ARROW THROUGH X | |
1039 | ⥓ ⥒ U+2953, U+2952 RIGHT/LEFTWARDS HARPOON WITH BARB UP TO BAR | |
1040 | ⥗ ⥖ U+2957, U+2956 RIGHT/LEFTWARDS HARPOON WITH BARB DOWN TO BAR | |
1041 | ⥛ ⥚ U+295B, U+295A RIGHT/LEFTWARDS HARPOON WITH BARB UP FROM BAR | |
1042 | ⥟ ⥞ U+295F, U+295E RIGHT/LEFTWARDS HARPOON WITH BARB DOWN FROM BAR | |
1043 | ⥤ ⥢ U+2964, U+2962 RIGHT/LEFTWARDS HARPOON WITH BARB UP ABOVE | |
1044 | RIGHT/LEFTWARDS HARPOON WITH BARB DOWN | |
1045 | ⥬ ⥪ U+296C, U+296A RIGHT/LEFTWARDS HARPOON WITH BARB UP ABOVE LONG | |
1046 | DASH | |
1047 | ⥭ ⥫ U+296D, U+296B RIGHT/LEFTWARDS HARPOON WITH BARB DOWN BELOW | |
1048 | LONG DASH | |
1049 | ⥱ ⭀ U+2971, U+2B40 EQUALS SIGN ABOVE RIGHT/LEFTWARDS ARROW | |
1050 | ⥲ ⭁ U+2972, U+2B41 TILDE OPERATOR ABOVE RIGHTWARDS ARROW, REVERSE | |
1051 | TILDE OPERATOR ABOVE LEFTWARDS ARROW | |
1052 | ⥴ ⭋ U+2974, U+2B4B RIGHTWARDS ARROW ABOVE TILDE OPERATOR, | |
1053 | LEFTWARDS ARROW ABOVE REVERSE TILDE OPERATOR | |
1054 | ⥵ ⭂ U+2975, U+2B42 RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO, | |
1055 | LEFTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO | |
1056 | ⥹ ⥻ U+2979, U+297B SUBSET/SUPERSET ABOVE RIGHT/LEFTWARDS ARROW | |
9c9853e8 KW |
1057 | ⦃ ⦄ U+2983, U+2984 LEFT/RIGHT WHITE CURLY BRACKET |
1058 | ⦅ ⦆ U+2985, U+2986 LEFT/RIGHT WHITE PARENTHESIS | |
1059 | ⦇ ⦈ U+2987, U+2988 Z NOTATION LEFT/RIGHT IMAGE BRACKET | |
1060 | ⦉ ⦊ U+2989, U+298A Z NOTATION LEFT/RIGHT BINDING BRACKET | |
1061 | ⦋ ⦌ U+298B, U+298C LEFT/RIGHT SQUARE BRACKET WITH UNDERBAR | |
1062 | ⦍ ⦐ U+298D, U+2990 LEFT/RIGHT SQUARE BRACKET WITH TICK IN TOP | |
1063 | CORNER | |
1064 | ⦏ ⦎ U+298F, U+298E LEFT/RIGHT SQUARE BRACKET WITH TICK IN BOTTOM | |
1065 | CORNER | |
1066 | ⦑ ⦒ U+2991, U+2992 LEFT/RIGHT ANGLE BRACKET WITH DOT | |
7e4a71c6 KW |
1067 | ⦓ ⦔ U+2993, U+2994 LEFT/RIGHT ARC LESS-THAN/GREATER-THAN BRACKET |
1068 | ⦕ ⦖ U+2995, U+2996 DOUBLE LEFT/RIGHT ARC GREATER-THAN/LESS-THAN | |
1069 | BRACKET | |
9c9853e8 | 1070 | ⦗ ⦘ U+2997, U+2998 LEFT/RIGHT BLACK TORTOISE SHELL BRACKET |
0b6e3da1 KW |
1071 | ⦨ ⦩ U+29A8, U+29A9 MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW |
1072 | POINTING UP AND RIGHT/LEFT | |
1073 | ⦪ ⦫ U+29AA, U+29AB MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW | |
1074 | POINTING DOWN AND RIGHT/LEFT | |
1075 | ⦳ ⦴ U+29B3, U+29B4 EMPTY SET WITH RIGHT/LEFT ARROW ABOVE | |
7e4a71c6 | 1076 | ⧀ ⧁ U+29C0, U+29C1 CIRCLED LESS-THAN/GREATER-THAN |
9c9853e8 KW |
1077 | ⧘ ⧙ U+29D8, U+29D9 LEFT/RIGHT WIGGLY FENCE |
1078 | ⧚ ⧛ U+29DA, U+29DB LEFT/RIGHT DOUBLE WIGGLY FENCE | |
1079 | ⧼ ⧽ U+29FC, U+29FD LEFT/RIGHT-POINTING CURVED ANGLE BRACKET | |
7e4a71c6 KW |
1080 | ⩹ ⩺ U+2A79, U+2A7A LESS-THAN/GREATER-THAN WITH CIRCLE INSIDE |
1081 | ⩻ ⩼ U+2A7B, U+2A7C LESS-THAN/GREATER-THAN WITH QUESTION MARK ABOVE | |
1082 | ⩽ ⩾ U+2A7D, U+2A7E LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO | |
1083 | ⩿ ⪀ U+2A7F, U+2A80 LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH | |
1084 | DOT INSIDE | |
1085 | ⪁ ⪂ U+2A81, U+2A82 LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH | |
1086 | DOT ABOVE | |
1087 | ⪃ ⪄ U+2A83, U+2A84 LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH | |
1088 | DOT ABOVE RIGHT/LEFT | |
1089 | ⪅ ⪆ U+2A85, U+2A86 LESS-THAN/GREATER-THAN OR APPROXIMATE | |
1090 | ⪇ ⪈ U+2A87, U+2A88 LESS-THAN/GREATER-THAN AND SINGLE-LINE NOT | |
1091 | EQUAL TO | |
1092 | ⪉ ⪊ U+2A89, U+2A8A LESS-THAN/GREATER-THAN AND NOT APPROXIMATE | |
1093 | ⪍ ⪎ U+2A8D, U+2A8E LESS-THAN/GREATER-THAN ABOVE SIMILAR OR EQUAL | |
1094 | ⪕ ⪖ U+2A95, U+2A96 SLANTED EQUAL TO OR LESS-THAN/GREATER-THAN | |
1095 | ⪗ ⪘ U+2A97, U+2A98 SLANTED EQUAL TO OR LESS-THAN/GREATER-THAN WITH | |
1096 | DOT INSIDE | |
1097 | ⪙ ⪚ U+2A99, U+2A9A DOUBLE-LINE EQUAL TO OR LESS-THAN/GREATER-THAN | |
1098 | ⪛ ⪜ U+2A9B, U+2A9C DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN/ | |
1099 | GREATER-THAN | |
1100 | ⪝ ⪞ U+2A9D, U+2A9E SIMILAR OR LESS-THAN/GREATER-THAN | |
1101 | ⪟ ⪠ U+2A9F, U+2AA0 SIMILAR ABOVE LESS-THAN/GREATER-THAN ABOVE | |
1102 | EQUALS SIGN | |
1103 | ⪡ ⪢ U+2AA1, U+2AA2 DOUBLE NESTED LESS-THAN/GREATER-THAN | |
1104 | ⪦ ⪧ U+2AA6, U+2AA7 LESS-THAN/GREATER-THAN CLOSED BY CURVE | |
1105 | ⪨ ⪩ U+2AA8, U+2AA9 LESS-THAN/GREATER-THAN CLOSED BY CURVE ABOVE | |
1106 | SLANTED EQUAL | |
36327261 KW |
1107 | ⪪ ⪫ U+2AAA, U+2AAB SMALLER THAN/LARGER THAN |
1108 | ⪬ ⪭ U+2AAC, U+2AAD SMALLER THAN/LARGER THAN OR EQUAL TO | |
6763e244 KW |
1109 | ⪯ ⪰ U+2AAF, U+2AB0 PRECEDES/SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN |
1110 | ⪱ ⪲ U+2AB1, U+2AB2 PRECEDES/SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO | |
1111 | ⪳ ⪴ U+2AB3, U+2AB4 PRECEDES/SUCCEEDS ABOVE EQUALS SIGN | |
1112 | ⪵ ⪶ U+2AB5, U+2AB6 PRECEDES/SUCCEEDS ABOVE NOT EQUAL TO | |
1113 | ⪷ ⪸ U+2AB7, U+2AB8 PRECEDES/SUCCEEDS ABOVE ALMOST EQUAL TO | |
1114 | ⪹ ⪺ U+2AB9, U+2ABA PRECEDES/SUCCEEDS ABOVE NOT ALMOST EQUAL TO | |
1115 | ⪻ ⪼ U+2ABB, U+2ABC DOUBLE PRECEDES/SUCCEEDS | |
0a4ec1c0 KW |
1116 | ⪽ ⪾ U+2ABD, U+2ABE SUBSET/SUPERSET WITH DOT |
1117 | ⪿ ⫀ U+2ABF, U+2AC0 SUBSET/SUPERSET WITH PLUS SIGN BELOW | |
1118 | ⫁ ⫂ U+2AC1, U+2AC2 SUBSET/SUPERSET WITH MULTIPLICATION SIGN BELOW | |
1119 | ⫃ ⫄ U+2AC3, U+2AC4 SUBSET/SUPERSET OF OR EQUAL TO WITH DOT ABOVE | |
1120 | ⫅ ⫆ U+2AC5, U+2AC6 SUBSET/SUPERSET OF ABOVE EQUALS SIGN | |
1121 | ⫇ ⫈ U+2AC7, U+2AC8 SUBSET/SUPERSET OF ABOVE TILDE OPERATOR | |
1122 | ⫉ ⫊ U+2AC9, U+2ACA SUBSET/SUPERSET OF ABOVE ALMOST EQUAL TO | |
1123 | ⫋ ⫌ U+2ACB, U+2ACC SUBSET/SUPERSET OF ABOVE NOT EQUAL TO | |
1124 | ⫏ ⫐ U+2ACF, U+2AD0 CLOSED SUBSET/SUPERSET | |
1125 | ⫑ ⫒ U+2AD1, U+2AD2 CLOSED SUBSET/SUPERSET OR EQUAL TO | |
1126 | ⫕ ⫖ U+2AD5, U+2AD6 SUBSET/SUPERSET ABOVE SUBSET/SUPERSET | |
84c1ecba | 1127 | ⫥ ⊫ U+2AE5, U+22AB DOUBLE VERTICAL BAR DOUBLE LEFT/RIGHT TURNSTILE |
7e4a71c6 KW |
1128 | ⫷ ⫸ U+2AF7, U+2AF8 TRIPLE NESTED LESS-THAN/GREATER-THAN |
1129 | ⫹ ⫺ U+2AF9, U+2AFA DOUBLE-LINE SLANTED LESS-THAN/GREATER-THAN OR | |
1130 | EQUAL TO | |
0b6e3da1 KW |
1131 | ⭆ ⭅ U+2B46, U+2B45 RIGHT/LEFTWARDS QUADRUPLE ARROW |
1132 | ⭇ ⭉ U+2B47, U+2B49 REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW, | |
1133 | TILDE OPERATOR ABOVE LEFTWARDS ARROW | |
1134 | ⭈ ⭊ U+2B48, U+2B4A RIGHTWARDS ARROW ABOVE REVERSE ALMOST EQUAL | |
1135 | TO, LEFTWARDS ARROW ABOVE ALMOST EQUAL TO | |
1136 | ⭌ ⥳ U+2B4C, U+2973 RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR, | |
1137 | LEFTWARDS ARROW ABOVE TILDE OPERATOR | |
1138 | ⭢ ⭠ U+2B62, U+2B60 RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW | |
1139 | ⭬ ⭪ U+2B6C, U+2B6A RIGHT/LEFTWARDS TRIANGLE-HEADED DASHED ARROW | |
1140 | ⭲ ⭰ U+2B72, U+2B70 RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW TO BAR | |
1141 | ⭼ ⭺ U+2B7C, U+2B7A RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH | |
1142 | DOUBLE VERTICAL STROKE | |
1143 | ⮆ ⮄ U+2B86, U+2B84 RIGHT/LEFTWARDS TRIANGLE-HEADED PAIRED ARROWS | |
1144 | ⮊ ⮈ U+2B8A, U+2B88 RIGHT/LEFTWARDS BLACK CIRCLED WHITE ARROW | |
1145 | ⮕ ⬅ U+2B95, U+2B05 RIGHT/LEFTWARDS BLACK ARROW | |
1146 | ⮚ ⮘ U+2B9A, U+2B98 THREE-D TOP-LIGHTED RIGHT/LEFTWARDS EQUILATERAL | |
1147 | ARROWHEAD | |
1148 | ⮞ ⮜ U+2B9E, U+2B9C BLACK RIGHT/LEFTWARDS EQUILATERAL ARROWHEAD | |
1149 | ⮡ ⮠ U+2BA1, U+2BA0 DOWNWARDS TRIANGLE-HEADED ARROW WITH LONG TIP | |
1150 | RIGHT/LEFTWARDS | |
1151 | ⮣ ⮢ U+2BA3, U+2BA2 UPWARDS TRIANGLE-HEADED ARROW WITH LONG TIP | |
1152 | RIGHT/LEFTWARDS | |
1153 | ⮩ ⮨ U+2BA9, U+2BA8 BLACK CURVED DOWNWARDS AND RIGHT/LEFTWARDS ARROW | |
1154 | ⮫ ⮪ U+2BAB, U+2BAA BLACK CURVED UPWARDS AND RIGHT/LEFTWARDS ARROW | |
1155 | ⮱ ⮰ U+2BB1, U+2BB0 RIBBON ARROW DOWN RIGHT/LEFT | |
1156 | ⮳ ⮲ U+2BB3, U+2BB2 RIBBON ARROW UP RIGHT/LEFT | |
1157 | ⯮ ⯬ U+2BEE, U+2BEC RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE | |
1158 | ARROWHEADS | |
9c9853e8 | 1159 | ⸂ ⸃ U+2E02, U+2E03 LEFT/RIGHT SUBSTITUTION BRACKET |
835f2666 | 1160 | ⸃ ⸂ U+2E03, U+2E02 RIGHT/LEFT SUBSTITUTION BRACKET |
9c9853e8 | 1161 | ⸄ ⸅ U+2E04, U+2E05 LEFT/RIGHT DOTTED SUBSTITUTION BRACKET |
835f2666 | 1162 | ⸅ ⸄ U+2E05, U+2E04 RIGHT/LEFT DOTTED SUBSTITUTION BRACKET |
9c9853e8 | 1163 | ⸉ ⸊ U+2E09, U+2E0A LEFT/RIGHT TRANSPOSITION BRACKET |
835f2666 | 1164 | ⸊ ⸉ U+2E0A, U+2E09 RIGHT/LEFT TRANSPOSITION BRACKET |
9c9853e8 | 1165 | ⸌ ⸍ U+2E0C, U+2E0D LEFT/RIGHT RAISED OMISSION BRACKET |
835f2666 | 1166 | ⸍ ⸌ U+2E0D, U+2E0C RIGHT/LEFT RAISED OMISSION BRACKET |
210ad843 | 1167 | ⸑ ⸐ U+2E11, U+2E10 REVERSED FORKED PARAGRAPHOS, FORKED PARAGRAPHOS |
9c9853e8 | 1168 | ⸜ ⸝ U+2E1C, U+2E1D LEFT/RIGHT LOW PARAPHRASE BRACKET |
835f2666 | 1169 | ⸝ ⸜ U+2E1D, U+2E1C RIGHT/LEFT LOW PARAPHRASE BRACKET |
9c9853e8 | 1170 | ⸠ ⸡ U+2E20, U+2E21 LEFT/RIGHT VERTICAL BAR WITH QUILL |
835f2666 | 1171 | ⸡ ⸠ U+2E21, U+2E20 RIGHT/LEFT VERTICAL BAR WITH QUILL |
9c9853e8 KW |
1172 | ⸢ ⸣ U+2E22, U+2E23 TOP LEFT/RIGHT HALF BRACKET |
1173 | ⸤ ⸥ U+2E24, U+2E25 BOTTOM LEFT/RIGHT HALF BRACKET | |
1174 | ⸦ ⸧ U+2E26, U+2E27 LEFT/RIGHT SIDEWAYS U BRACKET | |
1175 | ⸨ ⸩ U+2E28, U+2E29 LEFT/RIGHT DOUBLE PARENTHESIS | |
210ad843 | 1176 | ⸶ ⸷ U+2E36, U+2E37 DAGGER WITH LEFT/RIGHT GUARD |
565fbe1b KW |
1177 | ⹂ „ U+2E42, U+201E DOUBLE LOW-REVERSED-9 QUOTATION MARK, DOUBLE |
1178 | LOW-9 QUOTATION MARK | |
9c9853e8 KW |
1179 | ⹕ ⹖ U+2E55, U+2E56 LEFT/RIGHT SQUARE BRACKET WITH STROKE |
1180 | ⹗ ⹘ U+2E57, U+2E58 LEFT/RIGHT SQUARE BRACKET WITH DOUBLE STROKE | |
1181 | ⹙ ⹚ U+2E59, U+2E5A TOP HALF LEFT/RIGHT PARENTHESIS | |
1182 | ⹛ ⹜ U+2E5B, U+2E5C BOTTOM HALF LEFT/RIGHT PARENTHESIS | |
1183 | 〈 〉 U+3008, U+3009 LEFT/RIGHT ANGLE BRACKET | |
1184 | 《 》 U+300A, U+300B LEFT/RIGHT DOUBLE ANGLE BRACKET | |
1185 | 「 」 U+300C, U+300D LEFT/RIGHT CORNER BRACKET | |
1186 | 『 』 U+300E, U+300F LEFT/RIGHT WHITE CORNER BRACKET | |
1187 | 【 】 U+3010, U+3011 LEFT/RIGHT BLACK LENTICULAR BRACKET | |
1188 | 〔 〕 U+3014, U+3015 LEFT/RIGHT TORTOISE SHELL BRACKET | |
1189 | 〖 〗 U+3016, U+3017 LEFT/RIGHT WHITE LENTICULAR BRACKET | |
1190 | 〘 〙 U+3018, U+3019 LEFT/RIGHT WHITE TORTOISE SHELL BRACKET | |
1191 | 〚 〛 U+301A, U+301B LEFT/RIGHT WHITE SQUARE BRACKET | |
565fbe1b KW |
1192 | 〝 〞 U+301D, U+301E REVERSED DOUBLE PRIME QUOTATION MARK, DOUBLE |
1193 | PRIME QUOTATION MARK | |
210ad843 KW |
1194 | ꧁ ꧂ U+A9C1, U+A9C2 JAVANESE LEFT/RIGHT RERENGGAN |
1195 | ﴾ ﴿ U+FD3E, U+FD3F ORNATE LEFT/RIGHT PARENTHESIS | |
9c9853e8 KW |
1196 | ﹙ ﹚ U+FE59, U+FE5A SMALL LEFT/RIGHT PARENTHESIS |
1197 | ﹛ ﹜ U+FE5B, U+FE5C SMALL LEFT/RIGHT CURLY BRACKET | |
1198 | ﹝ ﹞ U+FE5D, U+FE5E SMALL LEFT/RIGHT TORTOISE SHELL BRACKET | |
7e4a71c6 | 1199 | ﹤ ﹥ U+FE64, U+FE65 SMALL LESS-THAN/GREATER-THAN SIGN |
9c9853e8 | 1200 | ( ) U+FF08, U+FF09 FULLWIDTH LEFT/RIGHT PARENTHESIS |
7e4a71c6 | 1201 | < > U+FF1C, U+FF1E FULLWIDTH LESS-THAN/GREATER-THAN SIGN |
9c9853e8 KW |
1202 | [ ] U+FF3B, U+FF3D FULLWIDTH LEFT/RIGHT SQUARE BRACKET |
1203 | { } U+FF5B, U+FF5D FULLWIDTH LEFT/RIGHT CURLY BRACKET | |
1204 | ⦅ ⦆ U+FF5F, U+FF60 FULLWIDTH LEFT/RIGHT WHITE PARENTHESIS | |
1205 | 「 」 U+FF62, U+FF63 HALFWIDTH LEFT/RIGHT CORNER BRACKET | |
0b6e3da1 | 1206 | → ← U+FFEB, U+FFE9 HALFWIDTH RIGHT/LEFTWARDS ARROW |
3e9e4fd8 KW |
1207 | 𝄃 𝄂 U+1D103, U+1D102 MUSICAL SYMBOL REVERSE FINAL BARLINE, MUSICAL |
1208 | SYMBOL FINAL BARLINE | |
1209 | 𝄆 𝄇 U+1D106, U+1D107 MUSICAL SYMBOL LEFT/RIGHT REPEAT SIGN | |
4a4b7455 | 1210 | 👉 👈 U+1F449, U+1F448 WHITE RIGHT/LEFT POINTING BACKHAND INDEX |
a863e562 KW |
1211 | 🔈 🕨 U+1F508, U+1F568 SPEAKER, RIGHT SPEAKER |
1212 | 🔉 🕩 U+1F509, U+1F569 SPEAKER WITH ONE SOUND WAVE, RIGHT SPEAKER WITH | |
1213 | ONE SOUND WAVE | |
1214 | 🔊 🕪 U+1F50A, U+1F56A SPEAKER WITH THREE SOUND WAVES, RIGHT SPEAKER | |
1215 | WITH THREE SOUND WAVES | |
ad558b4e | 1216 | 🕻 🕽 U+1F57B, U+1F57D LEFT/RIGHT HAND TELEPHONE RECEIVER |
4a4b7455 KW |
1217 | 🖙 🖘 U+1F599, U+1F598 SIDEWAYS WHITE RIGHT/LEFT POINTING INDEX |
1218 | 🖛 🖚 U+1F59B, U+1F59A SIDEWAYS BLACK RIGHT/LEFT POINTING INDEX | |
1219 | 🖝 🖜 U+1F59D, U+1F59C BLACK RIGHT/LEFT POINTING BACKHAND INDEX | |
e73a9e14 | 1220 | 🗦 🗧 U+1F5E6, U+1F5E7 THREE RAYS LEFT/RIGHT |
0b6e3da1 KW |
1221 | 🠂 🠀 U+1F802, U+1F800 RIGHT/LEFTWARDS ARROW WITH SMALL TRIANGLE |
1222 | ARROWHEAD | |
1223 | 🠆 🠄 U+1F806, U+1F804 RIGHT/LEFTWARDS ARROW WITH MEDIUM TRIANGLE | |
1224 | ARROWHEAD | |
1225 | 🠊 🠈 U+1F80A, U+1F808 RIGHT/LEFTWARDS ARROW WITH LARGE TRIANGLE | |
1226 | ARROWHEAD | |
1227 | 🠒 🠐 U+1F812, U+1F810 RIGHT/LEFTWARDS ARROW WITH SMALL EQUILATERAL | |
1228 | ARROWHEAD | |
1229 | 🠖 🠔 U+1F816, U+1F814 RIGHT/LEFTWARDS ARROW WITH EQUILATERAL ARROWHEAD | |
1230 | 🠚 🠘 U+1F81A, U+1F818 HEAVY RIGHT/LEFTWARDS ARROW WITH EQUILATERAL | |
1231 | ARROWHEAD | |
1232 | 🠞 🠜 U+1F81E, U+1F81C HEAVY RIGHT/LEFTWARDS ARROW WITH LARGE | |
1233 | EQUILATERAL ARROWHEAD | |
1234 | 🠢 🠠 U+1F822, U+1F820 RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH | |
1235 | NARROW SHAFT | |
1236 | 🠦 🠤 U+1F826, U+1F824 RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH | |
1237 | MEDIUM SHAFT | |
1238 | 🠪 🠨 U+1F82A, U+1F828 RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH BOLD | |
1239 | SHAFT | |
1240 | 🠮 🠬 U+1F82E, U+1F82C RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH | |
1241 | HEAVY SHAFT | |
1242 | 🠲 🠰 U+1F832, U+1F830 RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH VERY | |
1243 | HEAVY SHAFT | |
1244 | 🠶 🠴 U+1F836, U+1F834 RIGHT/LEFTWARDS FINGER-POST ARROW | |
1245 | 🠺 🠸 U+1F83A, U+1F838 RIGHT/LEFTWARDS SQUARED ARROW | |
1246 | 🠾 🠼 U+1F83E, U+1F83C RIGHT/LEFTWARDS COMPRESSED ARROW | |
1247 | 🡂 🡀 U+1F842, U+1F840 RIGHT/LEFTWARDS HEAVY COMPRESSED ARROW | |
1248 | 🡆 🡄 U+1F846, U+1F844 RIGHT/LEFTWARDS HEAVY ARROW | |
1249 | 🡒 🡐 U+1F852, U+1F850 RIGHT/LEFTWARDS SANS-SERIF ARROW | |
1250 | 🡢 🡠 U+1F862, U+1F860 WIDE-HEADED RIGHT/LEFTWARDS LIGHT BARB ARROW | |
1251 | 🡪 🡨 U+1F86A, U+1F868 WIDE-HEADED RIGHT/LEFTWARDS BARB ARROW | |
1252 | 🡲 🡰 U+1F872, U+1F870 WIDE-HEADED RIGHT/LEFTWARDS MEDIUM BARB ARROW | |
1253 | 🡺 🡸 U+1F87A, U+1F878 WIDE-HEADED RIGHT/LEFTWARDS HEAVY BARB ARROW | |
1254 | 🢂 🢀 U+1F882, U+1F880 WIDE-HEADED RIGHT/LEFTWARDS VERY HEAVY BARB | |
1255 | ARROW | |
1256 | 🢒 🢐 U+1F892, U+1F890 RIGHT/LEFTWARDS TRIANGLE ARROWHEAD | |
1257 | 🢖 🢔 U+1F896, U+1F894 RIGHT/LEFTWARDS WHITE ARROW WITHIN TRIANGLE | |
1258 | ARROWHEAD | |
1259 | 🢚 🢘 U+1F89A, U+1F898 RIGHT/LEFTWARDS ARROW WITH NOTCHED TAIL | |
1260 | 🢡 🢠 U+1F8A1, U+1F8A0 RIGHTWARDS BOTTOM SHADED WHITE ARROW, | |
1261 | LEFTWARDS BOTTOM-SHADED WHITE ARROW | |
1262 | 🢣 🢢 U+1F8A3, U+1F8A2 RIGHT/LEFTWARDS TOP SHADED WHITE ARROW | |
1263 | 🢥 🢦 U+1F8A5, U+1F8A6 RIGHT/LEFTWARDS RIGHT-SHADED WHITE ARROW | |
1264 | 🢧 🢤 U+1F8A7, U+1F8A4 RIGHT/LEFTWARDS LEFT-SHADED WHITE ARROW | |
1265 | 🢩 🢨 U+1F8A9, U+1F8A8 RIGHT/LEFTWARDS BACK-TILTED SHADOWED WHITE ARROW | |
1266 | 🢫 🢪 U+1F8AB, U+1F8AA RIGHT/LEFTWARDS FRONT-TILTED SHADOWED WHITE | |
1267 | ARROW | |
9c9853e8 | 1268 | |
69bcf1d3 FC |
1269 | =head1 FEATURE BUNDLES |
1270 | ||
1271 | It's possible to load multiple features together, using | |
1272 | a I<feature bundle>. The name of a feature bundle is prefixed with | |
1273 | a colon, to distinguish it from an actual feature. | |
1274 | ||
1275 | use feature ":5.10"; | |
1276 | ||
1277 | The following feature bundles are available: | |
1278 | ||
1279 | bundle features included | |
1280 | --------- ----------------- | |
2b3fe414 | 1281 | PODTURES |
69bcf1d3 FC |
1282 | The C<:default> bundle represents the feature set that is enabled before |
1283 | any C<use feature> or C<no feature> declaration. | |
1284 | ||
1285 | Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has | |
1286 | no effect. Feature bundles are guaranteed to be the same for all sub-versions. | |
1287 | ||
1288 | use feature ":5.14.0"; # same as ":5.14" | |
1289 | use feature ":5.14.1"; # same as ":5.14" | |
1290 | ||
1291 | =head1 IMPLICIT LOADING | |
1292 | ||
1293 | Instead of loading feature bundles by name, it is easier to let Perl do | |
1294 | implicit loading of a feature bundle for you. | |
1295 | ||
1296 | There are two ways to load the C<feature> pragma implicitly: | |
1297 | ||
1298 | =over 4 | |
1299 | ||
1300 | =item * | |
1301 | ||
1302 | By using the C<-E> switch on the Perl command-line instead of C<-e>. | |
1303 | That will enable the feature bundle for that version of Perl in the | |
1304 | main compilation unit (that is, the one-liner that follows C<-E>). | |
1305 | ||
1306 | =item * | |
1307 | ||
1308 | By explicitly requiring a minimum Perl version number for your program, with | |
1309 | the C<use VERSION> construct. That is, | |
1310 | ||
1311 | use v5.10.0; | |
1312 | ||
1313 | will do an implicit | |
1314 | ||
39ec54a5 | 1315 | no feature ':all'; |
69bcf1d3 FC |
1316 | use feature ':5.10'; |
1317 | ||
1318 | and so on. Note how the trailing sub-version | |
1319 | is automatically stripped from the | |
1320 | version. | |
1321 | ||
1322 | But to avoid portability warnings (see L<perlfunc/use>), you may prefer: | |
1323 | ||
1324 | use 5.010; | |
1325 | ||
1326 | with the same effect. | |
1327 | ||
1328 | If the required version is older than Perl 5.10, the ":default" feature | |
1329 | bundle is automatically loaded instead. | |
1330 | ||
affe54fa AC |
1331 | Unlike C<use feature ":5.12">, saying C<use v5.12> (or any higher version) |
1332 | also does the equivalent of C<use strict>; see L<perlfunc/use> for details. | |
1333 | ||
69bcf1d3 FC |
1334 | =back |
1335 | ||
7e18321c TC |
1336 | =head1 CHECKING FEATURES |
1337 | ||
1338 | C<feature> provides some simple APIs to check which features are enabled. | |
1339 | ||
1340 | These functions cannot be imported and must be called by their fully | |
1341 | qualified names. If you don't otherwise need to set a feature you will | |
1342 | need to ensure C<feature> is loaded with: | |
1343 | ||
1344 | use feature (); | |
1345 | ||
1346 | =over | |
1347 | ||
1348 | =item feature_enabled($feature) | |
1349 | ||
1350 | =item feature_enabled($feature, $depth) | |
1351 | ||
1352 | package MyStandardEnforcer; | |
1353 | use feature (); | |
1354 | use Carp "croak"; | |
1355 | sub import { | |
1356 | croak "disable indirect!" if feature::feature_enabled("indirect"); | |
1357 | } | |
1358 | ||
1359 | Test whether a named feature is enabled at a given level in the call | |
1360 | stack, returning a true value if it is. C<$depth> defaults to 1, | |
1361 | which checks the scope that called the scope calling | |
1362 | feature::feature_enabled(). | |
1363 | ||
1364 | croaks for an unknown feature name. | |
1365 | ||
1366 | =item features_enabled() | |
1367 | ||
1368 | =item features_enabled($depth) | |
1369 | ||
1370 | package ReportEnabledFeatures; | |
1371 | use feature "say"; | |
1372 | sub import { | |
1373 | say STDERR join " ", feature::features_enabled(); | |
1374 | } | |
1375 | ||
1376 | Returns a list of the features enabled at a given level in the call | |
1377 | stack. C<$depth> defaults to 1, which checks the scope that called | |
1378 | the scope calling feature::features_enabled(). | |
1379 | ||
1380 | =item feature_bundle() | |
1381 | ||
1382 | =item feature_bundle($depth) | |
1383 | ||
1384 | Returns the feature bundle, if any, selected at a given level in the | |
1385 | call stack. C<$depth> defaults to 1, which checks the scope that called | |
1386 | the scope calling feature::feature_bundle(). | |
1387 | ||
1388 | Returns an undefined value if no feature bundle is selected in the | |
1389 | scope. | |
1390 | ||
1391 | The bundle name returned will be for the earliest bundle matching the | |
1392 | selected bundle, so: | |
1393 | ||
1394 | use feature (); | |
1395 | use v5.12; | |
1396 | BEGIN { print feature::feature_bundle(0); } | |
1397 | ||
1398 | will print C<5.11>. | |
1399 | ||
1400 | This returns internal state, at this point C<use v5.12;> sets the | |
1401 | feature bundle, but C< use feature ":5.12"; > does not set the feature | |
1402 | bundle. This may change in a future release of perl. | |
1403 | ||
1404 | =back | |
1405 | ||
69bcf1d3 FC |
1406 | =cut |
1407 | ||
1408 | sub import { | |
22055af9 | 1409 | shift; |
36143a0c NC |
1410 | |
1411 | if (!@_) { | |
69bcf1d3 FC |
1412 | croak("No features specified"); |
1413 | } | |
36143a0c | 1414 | |
d3757264 | 1415 | __common(1, @_); |
69bcf1d3 FC |
1416 | } |
1417 | ||
1418 | sub unimport { | |
22055af9 | 1419 | shift; |
69bcf1d3 | 1420 | |
39ec54a5 | 1421 | # A bare C<no feature> should reset to the default bundle |
69bcf1d3 | 1422 | if (!@_) { |
39ec54a5 RS |
1423 | $^H &= ~($hint_uni8bit|$hint_mask); |
1424 | return; | |
69bcf1d3 FC |
1425 | } |
1426 | ||
d3757264 NC |
1427 | __common(0, @_); |
1428 | } | |
1429 | ||
1430 | ||
1431 | sub __common { | |
1432 | my $import = shift; | |
0c8d5017 NC |
1433 | my $bundle_number = $^H & $hint_mask; |
1434 | my $features = $bundle_number != $hint_mask | |
9f601cf3 | 1435 | && $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]}; |
0c8d5017 | 1436 | if ($features) { |
da5b5421 | 1437 | # Features are enabled implicitly via bundle hints. |
d9ee6ccb NC |
1438 | # Delete any keys that may be left over from last time. |
1439 | delete @^H{ values(%feature) }; | |
1440 | $^H |= $hint_mask; | |
1441 | for (@$features) { | |
1442 | $^H{$feature{$_}} = 1; | |
1443 | $^H |= $hint_uni8bit if $_ eq 'unicode_strings'; | |
1444 | } | |
da5b5421 | 1445 | } |
69bcf1d3 FC |
1446 | while (@_) { |
1447 | my $name = shift; | |
1448 | if (substr($name, 0, 1) eq ":") { | |
1449 | my $v = substr($name, 1); | |
1450 | if (!exists $feature_bundle{$v}) { | |
1451 | $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/; | |
1452 | if (!exists $feature_bundle{$v}) { | |
1453 | unknown_feature_bundle(substr($name, 1)); | |
1454 | } | |
1455 | } | |
1456 | unshift @_, @{$feature_bundle{$v}}; | |
1457 | next; | |
1458 | } | |
36143a0c | 1459 | if (!exists $feature{$name}) { |
db629560 FC |
1460 | if (exists $noops{$name}) { |
1461 | next; | |
1462 | } | |
c22e17d0 DIM |
1463 | if (!$import && exists $removed{$name}) { |
1464 | next; | |
1465 | } | |
69bcf1d3 | 1466 | unknown_feature($name); |
69bcf1d3 | 1467 | } |
d3757264 NC |
1468 | if ($import) { |
1469 | $^H{$feature{$name}} = 1; | |
1470 | $^H |= $hint_uni8bit if $name eq 'unicode_strings'; | |
1471 | } else { | |
69bcf1d3 FC |
1472 | delete $^H{$feature{$name}}; |
1473 | $^H &= ~ $hint_uni8bit if $name eq 'unicode_strings'; | |
1474 | } | |
1475 | } | |
1476 | } | |
1477 | ||
1478 | sub unknown_feature { | |
1479 | my $feature = shift; | |
1480 | croak(sprintf('Feature "%s" is not supported by Perl %vd', | |
1481 | $feature, $^V)); | |
1482 | } | |
1483 | ||
1484 | sub unknown_feature_bundle { | |
1485 | my $feature = shift; | |
1486 | croak(sprintf('Feature bundle "%s" is not supported by Perl %vd', | |
1487 | $feature, $^V)); | |
1488 | } | |
1489 | ||
1490 | sub croak { | |
1491 | require Carp; | |
1492 | Carp::croak(@_); | |
1493 | } | |
1494 | ||
7e18321c TC |
1495 | sub features_enabled { |
1496 | my ($depth) = @_; | |
1497 | ||
1498 | $depth //= 1; | |
1499 | my @frame = caller($depth+1) | |
1500 | or return; | |
1501 | my ($hints, $hinthash) = @frame[8, 10]; | |
1502 | ||
1503 | my $bundle_number = $hints & $hint_mask; | |
1504 | if ($bundle_number != $hint_mask) { | |
1505 | return $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]}->@*; | |
1506 | } | |
1507 | else { | |
1508 | my @features; | |
1509 | for my $feature (sort keys %feature) { | |
1510 | if ($hinthash->{$feature{$feature}}) { | |
1511 | push @features, $feature; | |
1512 | } | |
1513 | } | |
1514 | return @features; | |
1515 | } | |
1516 | } | |
1517 | ||
1518 | sub feature_enabled { | |
1519 | my ($feature, $depth) = @_; | |
1520 | ||
1521 | $depth //= 1; | |
1522 | my @frame = caller($depth+1) | |
1523 | or return; | |
1524 | my ($hints, $hinthash) = @frame[8, 10]; | |
1525 | ||
1526 | my $hint_feature = $feature{$feature} | |
1527 | or croak "Unknown feature $feature"; | |
1528 | my $bundle_number = $hints & $hint_mask; | |
1529 | if ($bundle_number != $hint_mask) { | |
1530 | my $bundle = $hint_bundles[$bundle_number >> $hint_shift]; | |
1531 | for my $bundle_feature ($feature_bundle{$bundle}->@*) { | |
1532 | return 1 if $bundle_feature eq $feature; | |
1533 | } | |
1534 | return 0; | |
1535 | } | |
1536 | else { | |
1537 | return $hinthash->{$hint_feature} // 0; | |
1538 | } | |
1539 | } | |
1540 | ||
1541 | sub feature_bundle { | |
1542 | my $depth = shift; | |
1543 | ||
1544 | $depth //= 1; | |
1545 | my @frame = caller($depth+1) | |
1546 | or return; | |
1547 | my $bundle_number = $frame[8] & $hint_mask; | |
1548 | if ($bundle_number != $hint_mask) { | |
1549 | return $hint_bundles[$bundle_number >> $hint_shift]; | |
1550 | } | |
1551 | else { | |
1552 | return undef; | |
1553 | } | |
1554 | } | |
1555 | ||
69bcf1d3 | 1556 | 1; |