bugGNU gettext - Bugs: bug #49818, Incomplete list of Perl functions...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49818: Incomplete list of Perl functions without arguments

Submitted by:  Bruno Haible <haible>
Submitted on:  Fri 09 Dec 2016 07:55:26 PM UTC  
 
Category: PerlSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: Guido Flohr <gflohr>
Open/Closed: Open

Mon 12 Dec 2016 01:32:01 PM UTC, comment #1:

1) Fixed in e4796a6

2) I have to re-check the list.

I had used the command "perldoc perlfunc" as the base for the qualification of keywords, and I think it is more complete than http://perldoc.perl.org/index-functions.html

A handful of the items are operators ("if", "else", "and", ...) and are already handled. But there could be new ones that should be added.

Then there a keywords like "break", which can oddly enough be used like a parameterless function call "break()". Others from the same group, for example "__FILE__" can only be used as such ("__FILE__()" is a syntax error).

At first glance it looks like it makes sense to treat all of the "Non-function keywords" either as operators or functions for our purposes.

I will go through the list one by one. It contains a lot of additions to the Perl language that are not yet handled by x-perl.c.

At the end of the day, the parser actually does not care whether a certain symbol represents a function name, a keyword, an operator or whatever else. We are trying to disambiguate this case here:

foo / bar / gm;

One interpretations is a chained division:

foo() / bar() / gm()

The other one is an invocation of the function foo() with a regex/pattern match as its argument:

foo(/ bar /gm)

That can only be disambiguated at run-time, but knowing the prototypes of the builtin functions helps at least a little.

Guido Flohr <gflohr>
Project MemberIn charge of this item.
Fri 09 Dec 2016 07:55:26 PM UTC, original submission:

The list of "Perl built-in function that does not accept arguments" in function x_perl_lex (file x-perl.c, around line 2780) has two oddities:

1) It contains a duplicate: "wantarray" occurs twice.

2) It contains only 21 names, whereas in http://perldoc.perl.org/index-functions.html I can find 62 names that don't take arguments:

and
AUTOLOAD
BEGIN
break
CHECK
cmp
_DATA_
default
DESTROY
else
elseif
elsif
endgrent
endhostent
END
_END_
endnetent
endprotoent
endpwent
endservent
eq
_FILE_
foreach
fork
format
ge
getgrent
gethostent
getlogin
getnetent
getppid
getprotoent
getpwent
getservent
given
gt
if
INIT
le
_LINE_
lt
m
ne
not
or
_PACKAGE_
setgrent
setpwent
s
_SUB_
time
times
tr
UNITCHECK
unless
until
wait
wantarray
when
while
xor
y

Some of them have other uses, sure. Could you please clarify?

Bruno Haible <haible>
Project Administrator

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gflohr (Posted a comment)
  • -unavailable- added by haible (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1