Questions tagged [static-typing]
A statically-typed language is a language (such as Java, C, or C++) where variable types are known at compile time. In most of these languages, types must be expressly indicated by the programmer; in other cases (such as OCaml, Javascript), type inference allows the programmer to not indicate their variable types. Reference: Mozilla
                88 questions
            
            
            
                5
            
            votes
        
        
            
                3
            
            answers
        
        
            
                626
            
            views
        
        
            
            
        How much `auto` is too much when creating utility functions in C++?
                    How much auto is too much when creating utility functions in C++?
Here's an example. I have a Qt application where, at some point, I need to find what is the maximum value among the integers that are ...
                
            
       
        
            
                0
            
            votes
        
        
            
                3
            
            answers
        
        
            
                236
            
            views
        
        
            
            
        Is JSON Schema-based runtime validation more practical than static type hints in real-world Python applications?
                    Question Body
I'm currently developing a Python coding standard for use in enterprise-level internal systems. Our typical use cases include:
API input/output validation
Reading from databases, ...
                
            
       
        
            
                12
            
            votes
        
        
            
                9
            
            answers
        
        
            
                6k
            
            views
        
        
            
            
            
        At what point does using a statically typed language gain more benefit than using a dynamically typed language with optional type declaration? [closed]
                    In my understanding, the strengths of not using type are flexible and newbie-friendly, and the strengths of using type are easier to debug and reading code. However now you can use types on ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                315
            
            views
        
        
            
            
        Are there any general purpose visual programming "languages"? [closed]
                    Lately I've been surveying the programming language landscape and one of the languages I looked at was Pharo, a modern Smalltalk.
Programming using a living system that runs in a virtual machine seems ...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                316
            
            views
        
        
            
            
        Should a decorated function know about its decorator from a semantic point of view?
                    In this toy example some_function is... some function that takes a dict as an input and modifies it in place somehow.
def some_function(dct: dict):
    """Do something to the items in ...
                
            
       
        
            
                4
            
            votes
        
        
            
                3
            
            answers
        
        
            
                990
            
            views
        
        
            
            
            
        Is there a programming language other than Java, C#, and Go which includes null with its static object types?
                    I was reading the excellent book by Axel Raushmayer, Tackling TypeScript.
In this section of Chapter 7, the author makes the interesting claim
In many programming languages, null is part of all ...
                
            
       
        
            
                1
            
            vote
        
        
            
                3
            
            answers
        
        
            
                320
            
            views
        
        
            
            
        Are interchangeable types a security vulnerability? Are they good vectors for attack?
                    Suppose you are given a python API:
def onArgumentReceived(x):
    doWhatever(x) # expects a unicode string
I am not a security expert by any stretch of the imagination, however on the face of this, ...
                
            
       
        
            
                4
            
            votes
        
        
            
                5
            
            answers
        
        
            
                546
            
            views
        
        
            
            
            
        Converting Dynamic Typing To Static Programatically
                    See: Type inference with duck typing - does this work? Why is it not used?
And: General approach for proving decidability/undecidability
Hello, I wanted to ask a theoretical question about type system ...
                
            
       
        
            
                7
            
            votes
        
        
            
                5
            
            answers
        
        
            
                6k
            
            views
        
        
            
            
            
        Why is C# considered a statically-typed language, although it contains keywords such as `dynamic` and `var`?
                    C# is considered a statically-typed language. However, it contains keywords such as:
var, which infers the type at compile time, and
dynamic, which determines the type at runtime.
Is this a ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                4k
            
            views
        
        
            
            
            
        Return type specification if a Python function output type, is dependent on the input arguments of that function?
                    Context
Suppose one has a list of algorithms, which each have a multiple run/parameter configurations. Next, one wrote a generic function def get_mdsa_configs(self) -> List[MDSA_config]: that ...
                
            
       
        
            
                -2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                378
            
            views
        
        
            
        Domain Driven Design: ElasticSearch and Postgres together
                    Let me start by saying my knowledge of microservices isn't as strong as it could be. My understanding of DDD is that we'd draw a bounded context over an entity and that would be our service.
How does ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                221
            
            views
        
        
            
            
        Designing shared subtype functionality with correct type annotations in Python
                    To illustrate the problem, I'm defining a PositiveNumber class that is a subclass of a Number class. As Python doesn't support type casting, I'm defining the from_number as a convenience method I can ...
                
            
       
        
            
                2
            
            votes
        
        
            
                3
            
            answers
        
        
            
                279
            
            views
        
        
            
            
            
        Where is the boundary between things which can be statically typechecked, and those which must be typechecked dynamically?
                    I am brain storming on how to create a type system for a programming language, and what the compiler will do with the typing information. Here is what I have found, followed by the main question, ...
                
            
       
        
            
                4
            
            votes
        
        
            
                2
            
            answers
        
        
            
                2k
            
            views
        
        
            
            
        How are dynamic and static typings implemented?
                    As I understand, every programming language is either statically type checked or dynamically type checked (and there are cases where these two approaches are mixed, but for simplicity I won't mention ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                1k
            
            views
        
        
            
            
        Benefits of Dynamic Mocks over Static Mocks?
                    I'm not sure if static vs. dynamic mock is the terminology used to describe this comparison, but I got this terminology from types of mocking static vs dynamic and Hand-rolled mocks made easy. To ...
                
            
       
         
         
        