Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [type]

The tag has no usage guidance.

2
votes
2answers
117 views

Primitive type conversion in computer graphics

I have been repeatedly told that explicit type conversions are an indicator of bad code and they should be avoided. Now in all honesty I have been annoyed a bit by these claims due to the nature of ...
1
vote
0answers
40 views

What is the logic behind Media types' type+subtype combinations?

I am a bit confused by the nesting that occurs in Media types (also known as their former name 'MIME types'): The top level types are called application, text, image video, audio, message, model and ...
0
votes
1answer
329 views

Are C++ types classes? [closed]

I am trying to understand if C++ types are classes, like in Python for example. Otherwise what datatype is the type itself? E.g. int a = 10 what is int? Is just a token label used by the compiler to ...
-1
votes
1answer
32 views

concept name(s): container of different types which can be used like a type

I am looking for the name(s) of a concept I heard of. I know that it does not exist in many programming languages, but I think it exists at least in C++. Let me try to explain the concept. Assume I ...
22
votes
6answers
4k views

What is the common procedure used when compilers statically type check “complex” expressions?

Note: When I used "complex" in the title, I mean that the expression has many operators and operands. Not that the expression itself is complex. I've recently been working on a simple compiler to x86-...
0
votes
2answers
291 views

Should I test the aspects that type checking covers?

For example, should I test like this: // it shouldn't even compile since I'm using a static type-checking expect(addTen('string')).toThrowError() when it is already type-checked like this: function ...
1
vote
2answers
602 views

Arbitrary protobuf message as byte-array over Websocket - how to determine actual message type upfront

Protobuf is nice and dandy, but it was not made with self-description in mind. Now this is totally okay if you're using a well-defined protocol and want to replace e.g. SOAP-messages or just want to ...
8
votes
4answers
2k views

Is a “object constructor” a shorter name for a “function with name `object` returning type `object`”?

I mean, it's a matter of choosing words more than there is any difference between function and constructor call. The thing which is named "constructor of an object" can also be named "function with ...
2
votes
3answers
433 views

Which programming languages support type inference from variable names? [closed]

Which programming languages support type inference from variable names? By 'type inference', I mean, for example, in Swift, how if you let x = 39 then the compiler knows x is an Integer, because 39 ...
7
votes
1answer
802 views

Can the C++ template system be used to perform type safe operations of the relational algebra

Assume that the parameters of functions representing operations of the relational algebra are represented by individual types: structs or classes. An operation such as (natural) join will have ...
1
vote
3answers
631 views

Do dynamically typed languages, such as Ruby and JavaScript, do any dynamic type checking?

If we look at the definition of "dynamically-typed programming languages" in Wikipedia, it says: Programming languages which include dynamic type-checking but not static type-checking are often ...
4
votes
2answers
380 views

How and when did it happen that, a type is an interface?

I came from a highly functional and procedural background in programming, and never knew that a type is the same as an interface. As in the Design Patterns book by GoF, it says: A type is a name ...
0
votes
6answers
158 views

Would you create a specialized type just to wrap a primitive? [duplicate]

Often times in programming, we need to represent some value which can easily be represented using a simple primitive type. For example, in a game we might need to represent the velocity of a moving ...