Post 3343226 by amiloradovsky@functional.cafe
(DIR) More posts by amiloradovsky@functional.cafe
(DIR) Post #3329958 by veer66@toot.veer66.rocks
2019-01-24T16:41:31.895399Z
0 likes, 0 repeats
Perhaps C doesn’t need Generic because it doesn’t check type in many cases, for example, memset, which takes void * and size_t, works any array of any type?
(DIR) Post #3330093 by veer66@toot.veer66.rocks
2019-01-24T16:48:49.905055Z
0 likes, 0 repeats
works -> works for
(DIR) Post #3330136 by veer66@toot.veer66.rocks
2019-01-24T16:50:13.954851Z
0 likes, 0 repeats
We can use memset function to set value of a struct too. 😅
(DIR) Post #3343226 by amiloradovsky@functional.cafe
2019-01-24T17:12:50Z
1 likes, 1 repeats
@veer66 If you don't use static typing, you don't need polymorphism either.
(DIR) Post #3343349 by veer66@toot.veer66.rocks
2019-01-25T00:54:27.605953Z
0 likes, 0 repeats
@amiloradovsky I use polymorphism in Common Lisp and Julia.
(DIR) Post #3349837 by amiloradovsky@functional.cafe
2019-01-25T05:55:17Z
1 likes, 0 repeats
@veer66In dynamically-typed languages, every function is potentially polymorphic (until we've fount at run-time that it is not…) That kind of polymorphism is better called dynamic dispatch, I guess.
(DIR) Post #3350956 by veer66@toot.veer66.rocks
2019-01-25T07:07:56.062934Z
0 likes, 0 repeats
@amiloradovsky In Julia and Common Lisp with CLOS, we can specify types of arguments.
(DIR) Post #3352800 by amiloradovsky@functional.cafe
2019-01-25T07:48:38Z
1 likes, 0 repeats
@veer66Yes, these are optional. Many other dynamically-typed languages also support assertions on types; not sure though whether that info is used for static checking or indeed impacts the performance.Either way, that other thing is called strict typing discipline, beceuse you have to specify the type for every value, or provide enough non-controversial annotations for it to be derived automatically.The distinction is in fact blurry.
(DIR) Post #3352801 by amiloradovsky@functional.cafe
2019-01-25T07:50:38Z
1 likes, 0 repeats
@veer66I'd say, dynamic typing is when the default type, unless restricted, is the dependent sum of all the types in the universe (of small types).
(DIR) Post #3354204 by veer66@toot.veer66.rocks
2019-01-25T09:57:17.073767Z
0 likes, 0 repeats
@amiloradovsky Is it like static typing that automatically put Any/Object (type)?
(DIR) Post #3354423 by amiloradovsky@functional.cafe
2019-01-25T10:06:40Z
1 likes, 0 repeats
@veer66Perhaps. The values are the pairs: (a_type, a_value_of_that_type).
(DIR) Post #3354492 by veer66@toot.veer66.rocks
2019-01-25T10:10:16.397966Z
0 likes, 0 repeats
@amiloradovsky In Julia, a_type is Any by default. In Crystal, a compiler tries to guess a more specific type than Any.Is this all difference between dynamic and static typing?
(DIR) Post #3354946 by amiloradovsky@functional.cafe
2019-01-25T10:31:36Z
1 likes, 0 repeats
@veer66Mostly, I guess. The type inference mechanism will also start with the most general assumptions, then restrict the space of possible values, where required and propagate the restrictions, then check if there are any conflicts (the space is empty somewhere).If the typing discipline is dynamic, then no/less checks will be performed at build/compile time.