Subject: [FEATURE REQUEST] VisualBasic "Option Explicit" / Perl "use
strict" -- bringing variable pre-declaration to cython optionally

===================================================
Background:
already cython supports the following:
   #program1
    a1  = cython.declare(cython.int) # cdef int a1
    a2  = cython.declare(cython.double,0.57721) # cdef double a2 =0.57721
   #end program1
====================================================
The New Feature Request:

but will there be  - a feature in cython, in which - even though we are
"not" declaring "data types" of variables, but we are declaring variables
themselves. like:
------------
   #program2
   cython.option_strict(True)                                         ##
<------- see this statement
    a1  = cython.declare(cython.int) # cdef int a1
    a2  = cython.declare(cython.double,0.57721) # cdef double a2 =0.57721
    a3 = cython.declare(cython.var) #cdef var a3                      ##
<------- see this statement
    a4 = cython.declare(cython.var,0.57721) #cdef var a4=0.57721      ##
<------- see this statement


    a3 = 10                 # <----- This statement will not give error
    b1 = 10                 # <----- This statement will give
warning/error, as variable b1 was not declared and cython.option_strict()
is enabled
   #end program2
---------

Here we have declared the variables a3 and a4 using "cdef var", but we have
not declared their data types. For a1 and a2, we have declared their
datatypes too.
  But now, as cython.option_strict() is enabled(i.e., true);

      HENCE "b1=10"  statement will give error when cython compiles,
because "b1" variable which was not declared in any sense using
"cython.declare(cython.var) or cdef var" .

      But "a3 = 10" statement in above program will not warning/error,as
"a3" is already declared var

NOTE: This feature request is analogous to VisualBasic's "Option Explicit"
and perl's "use strict"

==================
Here are other people also requesting the similar thing:
http://stackoverflow.com/questions/613364/is-there-a-need-for-a-use-strict-python-compiler
http://stackoverflow.com/questions/13425715/does-python-have-a-use-strict-and-use-warnings-like-in-perl
http://stevesprogramming.blogspot.in/2013/03/why-python-needs-perls-use-strict.html
http://bytes.com/topic/python/answers/632587-python-feature-request-explicit-variable-declarations


Zaxebo1
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to