Is Common Lisp static or dynamically typed? If both how is it done? [closed]












2















I m doing a paper on python vs lisp in functional programming. I was seeing the typing system in Common Lisp. I have read that it is dynamic, lexical, strong. But my professor says it is static...can anyone clear this for me? its maddening!










share|improve this question















closed as too broad by Rainer Joswig, Unheilig, Owen Pauling, Basile Starynkevitch, greg-449 Nov 22 '18 at 11:45


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2





    Hi, Welcome to Stack Overflow! If you would google it you will find tutorials and articles that can explain you about your question in details than what we can do it here. Also as a new member please read how to ask. Thanks!

    – rbashish
    Nov 22 '18 at 7:17











  • What have you read about Common Lisp? Did you read the Common Lisp HyperSpec? Notice the typedeclaration. Did you try to play with some CL implementation, such as SBCL? SBCL is free software, so you can (and probably should) study some of its source code (written in Common Lisp) which is a good example of CL code.

    – Basile Starynkevitch
    Nov 22 '18 at 9:33








  • 2





    Actually, CL has both static and dynamic typing aspects. That it why it is fascinating.

    – Basile Starynkevitch
    Nov 22 '18 at 9:36











  • How is this too broad? Dynamic, period.

    – Kaz
    Dec 10 '18 at 1:36
















2















I m doing a paper on python vs lisp in functional programming. I was seeing the typing system in Common Lisp. I have read that it is dynamic, lexical, strong. But my professor says it is static...can anyone clear this for me? its maddening!










share|improve this question















closed as too broad by Rainer Joswig, Unheilig, Owen Pauling, Basile Starynkevitch, greg-449 Nov 22 '18 at 11:45


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2





    Hi, Welcome to Stack Overflow! If you would google it you will find tutorials and articles that can explain you about your question in details than what we can do it here. Also as a new member please read how to ask. Thanks!

    – rbashish
    Nov 22 '18 at 7:17











  • What have you read about Common Lisp? Did you read the Common Lisp HyperSpec? Notice the typedeclaration. Did you try to play with some CL implementation, such as SBCL? SBCL is free software, so you can (and probably should) study some of its source code (written in Common Lisp) which is a good example of CL code.

    – Basile Starynkevitch
    Nov 22 '18 at 9:33








  • 2





    Actually, CL has both static and dynamic typing aspects. That it why it is fascinating.

    – Basile Starynkevitch
    Nov 22 '18 at 9:36











  • How is this too broad? Dynamic, period.

    – Kaz
    Dec 10 '18 at 1:36














2












2








2








I m doing a paper on python vs lisp in functional programming. I was seeing the typing system in Common Lisp. I have read that it is dynamic, lexical, strong. But my professor says it is static...can anyone clear this for me? its maddening!










share|improve this question
















I m doing a paper on python vs lisp in functional programming. I was seeing the typing system in Common Lisp. I have read that it is dynamic, lexical, strong. But my professor says it is static...can anyone clear this for me? its maddening!







dynamic types static lisp common-lisp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 9:27









Will Ness

45.7k468124




45.7k468124










asked Nov 22 '18 at 6:51









Siddharth ChittoorSiddharth Chittoor

162




162




closed as too broad by Rainer Joswig, Unheilig, Owen Pauling, Basile Starynkevitch, greg-449 Nov 22 '18 at 11:45


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by Rainer Joswig, Unheilig, Owen Pauling, Basile Starynkevitch, greg-449 Nov 22 '18 at 11:45


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2





    Hi, Welcome to Stack Overflow! If you would google it you will find tutorials and articles that can explain you about your question in details than what we can do it here. Also as a new member please read how to ask. Thanks!

    – rbashish
    Nov 22 '18 at 7:17











  • What have you read about Common Lisp? Did you read the Common Lisp HyperSpec? Notice the typedeclaration. Did you try to play with some CL implementation, such as SBCL? SBCL is free software, so you can (and probably should) study some of its source code (written in Common Lisp) which is a good example of CL code.

    – Basile Starynkevitch
    Nov 22 '18 at 9:33








  • 2





    Actually, CL has both static and dynamic typing aspects. That it why it is fascinating.

    – Basile Starynkevitch
    Nov 22 '18 at 9:36











  • How is this too broad? Dynamic, period.

    – Kaz
    Dec 10 '18 at 1:36














  • 2





    Hi, Welcome to Stack Overflow! If you would google it you will find tutorials and articles that can explain you about your question in details than what we can do it here. Also as a new member please read how to ask. Thanks!

    – rbashish
    Nov 22 '18 at 7:17











  • What have you read about Common Lisp? Did you read the Common Lisp HyperSpec? Notice the typedeclaration. Did you try to play with some CL implementation, such as SBCL? SBCL is free software, so you can (and probably should) study some of its source code (written in Common Lisp) which is a good example of CL code.

    – Basile Starynkevitch
    Nov 22 '18 at 9:33








  • 2





    Actually, CL has both static and dynamic typing aspects. That it why it is fascinating.

    – Basile Starynkevitch
    Nov 22 '18 at 9:36











  • How is this too broad? Dynamic, period.

    – Kaz
    Dec 10 '18 at 1:36








2




2





Hi, Welcome to Stack Overflow! If you would google it you will find tutorials and articles that can explain you about your question in details than what we can do it here. Also as a new member please read how to ask. Thanks!

– rbashish
Nov 22 '18 at 7:17





Hi, Welcome to Stack Overflow! If you would google it you will find tutorials and articles that can explain you about your question in details than what we can do it here. Also as a new member please read how to ask. Thanks!

– rbashish
Nov 22 '18 at 7:17













What have you read about Common Lisp? Did you read the Common Lisp HyperSpec? Notice the typedeclaration. Did you try to play with some CL implementation, such as SBCL? SBCL is free software, so you can (and probably should) study some of its source code (written in Common Lisp) which is a good example of CL code.

– Basile Starynkevitch
Nov 22 '18 at 9:33







What have you read about Common Lisp? Did you read the Common Lisp HyperSpec? Notice the typedeclaration. Did you try to play with some CL implementation, such as SBCL? SBCL is free software, so you can (and probably should) study some of its source code (written in Common Lisp) which is a good example of CL code.

– Basile Starynkevitch
Nov 22 '18 at 9:33






2




2





Actually, CL has both static and dynamic typing aspects. That it why it is fascinating.

– Basile Starynkevitch
Nov 22 '18 at 9:36





Actually, CL has both static and dynamic typing aspects. That it why it is fascinating.

– Basile Starynkevitch
Nov 22 '18 at 9:36













How is this too broad? Dynamic, period.

– Kaz
Dec 10 '18 at 1:36





How is this too broad? Dynamic, period.

– Kaz
Dec 10 '18 at 1:36












1 Answer
1






active

oldest

votes


















7














According to the seminal paper on types by Luca Cardelli and Peter Wegner: On understanding types, data abstraction, and polymorphism, ACM Computing Surveys, 17(4):471-522, 1985,




Programming languages in which the type of every expression can be determined by static program analysis are said to be statically typed.




This is not true for Common Lisp. Consider, for instance, the following, legal, function definition:



(defun f(g x)
(funcall g x))


The type of the expression (funcall g x) inside the body of the function cannot be inferred or determined statically in any way.



In Common Lisp however you can, if you want, specify the types of the parameters of a function. For instance:



(defun f (g x)
(declare (type integer x)
(type (function (integer) float) g))
(funcall g x))


and in this case the compiler can infer that the type of (funcall g x) is float.



So, I think we could say that Common Lisp is not a statically typed language as normally intended, but it can be optionally used as such, if one provides appropriate type information.






share|improve this answer


























  • thank you. it is clear now :D !

    – Siddharth Chittoor
    Nov 22 '18 at 19:33


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














According to the seminal paper on types by Luca Cardelli and Peter Wegner: On understanding types, data abstraction, and polymorphism, ACM Computing Surveys, 17(4):471-522, 1985,




Programming languages in which the type of every expression can be determined by static program analysis are said to be statically typed.




This is not true for Common Lisp. Consider, for instance, the following, legal, function definition:



(defun f(g x)
(funcall g x))


The type of the expression (funcall g x) inside the body of the function cannot be inferred or determined statically in any way.



In Common Lisp however you can, if you want, specify the types of the parameters of a function. For instance:



(defun f (g x)
(declare (type integer x)
(type (function (integer) float) g))
(funcall g x))


and in this case the compiler can infer that the type of (funcall g x) is float.



So, I think we could say that Common Lisp is not a statically typed language as normally intended, but it can be optionally used as such, if one provides appropriate type information.






share|improve this answer


























  • thank you. it is clear now :D !

    – Siddharth Chittoor
    Nov 22 '18 at 19:33
















7














According to the seminal paper on types by Luca Cardelli and Peter Wegner: On understanding types, data abstraction, and polymorphism, ACM Computing Surveys, 17(4):471-522, 1985,




Programming languages in which the type of every expression can be determined by static program analysis are said to be statically typed.




This is not true for Common Lisp. Consider, for instance, the following, legal, function definition:



(defun f(g x)
(funcall g x))


The type of the expression (funcall g x) inside the body of the function cannot be inferred or determined statically in any way.



In Common Lisp however you can, if you want, specify the types of the parameters of a function. For instance:



(defun f (g x)
(declare (type integer x)
(type (function (integer) float) g))
(funcall g x))


and in this case the compiler can infer that the type of (funcall g x) is float.



So, I think we could say that Common Lisp is not a statically typed language as normally intended, but it can be optionally used as such, if one provides appropriate type information.






share|improve this answer


























  • thank you. it is clear now :D !

    – Siddharth Chittoor
    Nov 22 '18 at 19:33














7












7








7







According to the seminal paper on types by Luca Cardelli and Peter Wegner: On understanding types, data abstraction, and polymorphism, ACM Computing Surveys, 17(4):471-522, 1985,




Programming languages in which the type of every expression can be determined by static program analysis are said to be statically typed.




This is not true for Common Lisp. Consider, for instance, the following, legal, function definition:



(defun f(g x)
(funcall g x))


The type of the expression (funcall g x) inside the body of the function cannot be inferred or determined statically in any way.



In Common Lisp however you can, if you want, specify the types of the parameters of a function. For instance:



(defun f (g x)
(declare (type integer x)
(type (function (integer) float) g))
(funcall g x))


and in this case the compiler can infer that the type of (funcall g x) is float.



So, I think we could say that Common Lisp is not a statically typed language as normally intended, but it can be optionally used as such, if one provides appropriate type information.






share|improve this answer















According to the seminal paper on types by Luca Cardelli and Peter Wegner: On understanding types, data abstraction, and polymorphism, ACM Computing Surveys, 17(4):471-522, 1985,




Programming languages in which the type of every expression can be determined by static program analysis are said to be statically typed.




This is not true for Common Lisp. Consider, for instance, the following, legal, function definition:



(defun f(g x)
(funcall g x))


The type of the expression (funcall g x) inside the body of the function cannot be inferred or determined statically in any way.



In Common Lisp however you can, if you want, specify the types of the parameters of a function. For instance:



(defun f (g x)
(declare (type integer x)
(type (function (integer) float) g))
(funcall g x))


and in this case the compiler can infer that the type of (funcall g x) is float.



So, I think we could say that Common Lisp is not a statically typed language as normally intended, but it can be optionally used as such, if one provides appropriate type information.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 '18 at 10:37

























answered Nov 22 '18 at 10:18









RenzoRenzo

17.9k43043




17.9k43043













  • thank you. it is clear now :D !

    – Siddharth Chittoor
    Nov 22 '18 at 19:33



















  • thank you. it is clear now :D !

    – Siddharth Chittoor
    Nov 22 '18 at 19:33

















thank you. it is clear now :D !

– Siddharth Chittoor
Nov 22 '18 at 19:33





thank you. it is clear now :D !

– Siddharth Chittoor
Nov 22 '18 at 19:33





Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

'app-layout' is not a known element: how to share Component with different Modules