Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.91k stars 542 forks source link

evalexpr?evaltrue:evalfalse would like evaltrue defaulted by evalexpr #2243

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#3559 (status was 'resolved')

Searchable as RT3559$

p5pRT commented 24 years ago

From mar@cf.nettuno.it

This is a bug report for perl from mar@​cf.nettuno.it\, generated with the help of perlbug 1.28 running under perl v5.6.0.


This is not a bug\, but an usefull and easy enhancement -i think​: the syntax and use of   evalexpr?evaltruecase​:evalfalsecase can be enhanced with the capability of absence of evaltruecase expression

this absence can return by default the value of evalexpr

having   evalexpr?​:evalfalsecase similar but more efficient that (typical...)   evalexpr?evalexpr​:evalfalsecase

actually perl returns syntax error near "?​:"

for efficency and code more light

All the best\, Marco Munari \mar@&#8203;chiara\.dei\.unipd\.it -- /~v~~\ .​::​: ... Marco Munari ... :​::​::​::​::​::​::​::​::​:: Univers. :​::. \_ */ :​:: mailto​:mar@​cf.nettuno.it?subject=.signature :​: .\..\. :​: :​:   \A ...​::​: :​:   YV :​:: "Progress is implicitly due to perfect exceptions" :​::   / \ :​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​::​:. x(t)\,y(t) = th(3t-34.5)*e^[-(3t-34.5)^2]/2-4.3+e^(-1.8/t^2)/(.8*atg(t- 3)+2)(t-1.8)-.3th(5t-42.5)\,(1.4e^[-(3t-34.5)^2]+1-sgn[|t-8.5|-.5]*1.5* |sin(pi*t)|^[2e^(-(t-11.5)^2)+.5+e^(-(.6t-3.3)^2)])/(.5+t)+1 ; 0\<t\<14



Flags​:   category=core   severity=none


Site configuration information for perl v5.6.0​:

Configured by pixel at Fri Mar 31 16​:32​:49 CEST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration​:   Platform​:   osname=linux\, osvers=2.2.15-0.16mdksmp\, archname=i386-linux   uname='linux kenobi.mandrakesoft.com 2.2.15-0.16mdksmp #1 smp mon mar 13 16​:40​:10 cet 2000 i686 unknown '   config_args='-des -Dprefix=/usr -Darchname=i386-linux -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Ud_csh -Dman3dir=/usr/lib/perl5/man/man3 -Doptimize=-O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -pipe -s -mpentium -mcpu=pentium -march=pentium -ffast-math -fexpensive-optimizations'   hint=recommended\, useposix=true\, d_sigaction=define   usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef   useperlio=undef d_sfio=undef uselargefiles=define   use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef   Compiler​:   cc='cc'\, optimize='-O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -pipe -s -mpentium -mcpu=pentium -march=pentium -ffast-math -fexpensive-optimizations'\, gccversion=2.95.3 19991030 (prerelease)   cppflags='-fno-strict-aliasing'   ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'   stdchar='char'\, d_stdstdio=define\, usevfork=false   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=4\, usemymalloc=n\, prototype=define   Linker and Libraries​:   ld='cc'\, ldflags =' -L/usr/local/lib'   libpth=/usr/local/lib /lib /usr/lib   libs=-lnsl -ldl -lm -lc -lposix -lcrypt   libc=/lib/libc-2.1.3.so\, so=so\, useshrplib=false\, libperl=libperl.a   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-rdynamic'   cccdlflags='-fpic'\, lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:  


@​INC for perl v5.6.0​:   /usr/lib/perl5/5.6.0/i386-linux   /usr/lib/perl5/5.6.0   /usr/lib/perl5/site_perl/5.6.0/i386-linux   /usr/lib/perl5/site_perl/5.6.0   /usr/lib/perl5/site_perl/5.005/i386-linux   /usr/lib/perl5/site_perl/5.005   /usr/lib/perl5/site_perl   .


Environment for perl v5.6.0​:   HOME=/home/mar   LANG=en   LANGUAGE=en   LC_ALL=en   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=/usr/local/bin​:/bin​:/usr/bin​:/opt/jdk-1.2.2/bin​:/usr/X11R6/bin​:/home/mar/bin​:/opt/jdk-1.2.2/bin​:/usr/X11R6/bin   PERL_BADLANG (unset)   SHELL=/bin/bash

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

Marco Munari \mar@&#8203;cf\.nettuno\.it wrote

having evalexpr?​:evalfalsecase similar but more efficient that (typical...) evalexpr?evalexpr​:evalfalsecase

The || operator already does exactly what you are asking for.

Mike Guy

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

On 20 Jul 2000\, Marco Munari wrote​:

having evalexpr?​:evalfalsecase similar but more efficient that (typical...) evalexpr?evalexpr​:evalfalsecase

perhaps you want the equivalent (and currently legal)​:

  $val = evalexpr || evalfalsecase;

-Aaron

p5pRT commented 24 years ago

From @ysth

In article \Pine\.A41\.4\.05\.10007210845000\.67816\-100000@&#8203;node13\.unix\.Virginia\.EDU\, Aaron J Mackey \ajm6q@&#8203;virginia\.edu wrote​:

On 20 Jul 2000\, Marco Munari wrote​:

having evalexpr?​:evalfalsecase similar but more efficient that (typical...) evalexpr?evalexpr​:evalfalsecase

perhaps you want the equivalent (and currently legal)​:

$val = evalexpr || evalfalsecase;

Subtle difference​: C\<a ? a : b> gives boolean context to the first a. The second a and the b get whatever context comes from the outside. C\<a || b> gives scalar context to the a\, while b gets its context from the outside.