Most voted "typing" questions
For data type system related issues.
Learn more…349 questions
Sort by count of
-
4
votes1
answer225
viewsStrength of typing in Lua language
Lua has dynamic typing, but after all, is it strongly typed or weakly typed? Every source I consult has a different information, which left me in doubt.
-
4
votes2
answers459
viewsWhat’s the "Never" type for?
Today I was asked what the guy is for never Typescript, but it got confused for me. It just serves to say that it does not return anything? What’s the difference to the void?…
-
4
votes1
answer180
viewsWhy does Floattostr exist if Delphi does not possess the Float data type?
Reading about the data types of Delphi/Pascal I realized that there is no type Float, however, there is the function FloatToStr(), as well as StrToFloat(). In this case, you could use floating point…
-
4
votes2
answers214
viewsTrying to understand the Java print
Watch the code right below; public class Dois { public static void main(String[] args) { int a = 3; int b = 4; System.out.print(" " + 7 + 2 + " "); } } The score is 72, but I thought the result was…
-
4
votes2
answers1851
viewsWhat is the problem of using [n]varchar(max)?
Why the practice of using [n]varchar(max) can cause problems? In my scripts whenever I don’t really know what the length of a string and to prevent problems, I have used nvarchar(max). A few days…
-
4
votes3
answers214
viewsError: "Return should not be followed by an object expression"
I have this function that has a simple registration but is not registering My doubt would be on that return RES; which gives the error message below the code. //botao para cadastrar OS private void…
-
4
votes1
answer71
viewsWhat does Typevar’s covariant and contravariant of the Typing module mean?
When using the module typing Python, available in 3.5+ versions, it is possible to define new types using the structure TypeVar. from typing import TypeVar T = TypeVar('T') # Pode ser qualquer tipo…
-
4
votes1
answer115
viewsCreating a dictionary with void functions
I am for fun to develop a TCP server in C# that performs functions depending on the message that the connected client sends you, for now, I only managed to do what I want with functions that return…
-
4
votes1
answer304
viewsBinary sum result
A program capable of operating two binary numbers between 0-255. Program input needs to be in binary and output as well. I did it in a way that was working, so that if I pass in binary 1 + 11, the…
-
4
votes1
answer112
viewsWhy does Python have such big numbers?
What would be the largest number in python? Python shows the result of expressions like: >>> 8**150000 The result was 135465 digits! I wanted to know the language can do this.…
-
4
votes1
answer140
viewsHow to deal with Undefined (or null) union in Typescript?
I am implementing this method below but it is giving me this error: Type 'Task | Undefined' is not Assignable to type 'Task'. Type 'Undefined' is not Assignable to type 'Task'. I can’t fix it. The…
-
4
votes1
answer68
viewsWhat are dependent types and dependent language?
About what they are statically typed languages I am already aware, but the concept of dependently typed language is new to me. I think it has to do with something called dependent types, but I also…
characteristic-language typing language-independent computer-science type-theoryasked 3 years, 8 months ago Luiz Felipe 32,886 -
4
votes1
answer115
viewsHow to type keys (Keys) of objects nested in Typescript?
I need that guy ColumnDefinitionType accept the object keys IUser, as well as accept the keys of objects nested to the IUser. export interface IUser { userId: number; username: string; name: string;…
-
4
votes2
answers64
viewsIs it possible to perform an overload (Overload) with Arrow functions?
I have a function where the return type depends on the parameter type. I was able to declare this overload with function, but not with Arrow Function, because I get the error: Cannot redeclare…
-
3
votes1
answer295
viewsMap a CHAR-like field in the database to a bool-like field in C#, with Fluentnhibernate?
In the database I have a field ATIVO of the kind CHAR(1), where 'T' = true and 'F' = false. Today, in my application I am circumventing this problem with a "gambiarra", where I mapped my attribute…
-
3
votes3
answers272
viewsIncompatible types?
I am passing 3 parameters: a vector with the name of 30 cities, one with the x coordinates of the respective cities and the other with the y coordinates. I need to print on the screen the cities…
-
3
votes2
answers918
viewsHow to cast a typed class in C#?
I own the class Carro who inherits from the class Objeto and another class CarroTeste implementing the abstract class TesteBase that by its implements the interface ITeste, both (TesteBase and…
-
3
votes4
answers822
viewsWhen is a string considered a primitive type in web development?
I was in doubt in a class when the teacher said that a guy String was considered as primitive! But I learned in Object-Oriented Programming that are only primitive: Byte: 1 byte. Short: 2 bytes.…
-
3
votes4
answers498
viewsFull byte type cast
I have the following code: public class Principal { public static void main(String[] args){ int i = 10; byte b = 5; b = (byte)i; b += i; i = b; System.out.println( i ); } } I know the value returned…
-
3
votes3
answers325
viewsData types in SQL Server 2012 and HTML forms with PHP: date and monetary values
How can I put a mask in an HTML form, in the date and monetary value fields, then send this data to the database without having to convert the strings into types date and money? Explain: I have a…
-
3
votes2
answers159
viewsDouble wrapper initialization with int does not compile
I want to understand why this boot doesn’t work: (1): Double d = 10; // Não funciona I understand that Double is a wrapper, the compiler should convert this line to: (2): Double d =…
-
3
votes1
answer1906
views -
3
votes4
answers1202
viewsWhat kind of data to use for sale ID
I have a Windows Form application developed in C# and with SQL database. One of the functions of the system is to carry out SALE for several different COMPANIES and in several different POS (point…
-
3
votes2
answers109
viewsCustom typing
According to the DOC Type handling, the conversions allowed are: (int), (integer) - molde para inteiro (bool), (boolean) - converte para booleano (float), (double), (real) - converte para número de…
-
3
votes1
answer326
viewsTorque conversion limit in C
I developed this code in C for conversion from integer to binary, but the limit is 1023. Any number above this, the conversion ceases to be performed Why and possible solution? int binario(int num)…
-
3
votes2
answers125
viewsShould I use int_least8_t or int_fast8_t?
I am studying the limits of types that c++ 11 brought and I noticed that there are officially several types of integers. In addition to the Joint Declaration int now I can declare: int8_t…
-
3
votes2
answers154
viewsFind out if particular control is a button
I have the following code that serves to change the color of the buttons that are in a panel: private void mudaCorBotao(Button bt) { foreach(Control b in Panel_esq.Controls) { if (/*[O que devo…
-
3
votes1
answer1076
viewsPython type conversion
When writing some didactic examples in Python 2.7, I came across the following situation in the following program: a = 0b101 b = 0b111 c = a+b print c The result of this program is 12 (decimal). If…
-
3
votes1
answer190
viewsDivision always resulting in zero
The Alpha result is only returning 0. Why? package javaapplication4; public class MediaMovelSuavizaçãoExp { public double CalculoPrevisao(double[] valores){ double[] values = new…
-
3
votes2
answers178
viewsDuck type in Elixir
[5,a,15] = [5,10,15] Doing this type of assignment in Elixir is Duck Typing or are different concepts? I ask because I was left with doubt since on the left side is declared a "variable" without an…
-
3
votes2
answers179
viewsWhy can’t I assign a list of a more specific type than the declared type?
I have this class example: public class User : APerson { private string _userName; [DataMember] public virtual string UserName { get { return _userName; } set { if (string.IsNullOrWhiteSpace(value))…
-
3
votes1
answer81
viewsHow to use more than two types in function parameters?
Suppose the following function in PHP: function parse (string $text, array $callback) { # ... } In theory the parameter $callback must be a array, but it can also be accepted as string. How do I get…
-
3
votes2
answers242
viewsDifferent views of the same variable in C Language
I wrote the following code and, beside the line the displayed results. I’d like to understand why the different exhibitions. #include <stdio.h> int main() { int inteiro = 1; float decimal =…
-
3
votes1
answer161
viewsWhat name is given in C# when we use the expression "new {}"?
When I saw the use of expression new {} I remembered Javascript, where I use new Object and {} are equivalent. Just for study purposes, I made some comparisons, to see if Csharp followed the same…
-
3
votes1
answer255
viewsAllocation of operation in C
I don’t understand why in doing this operation, even though I’ve already declared r as float, if you do not place the cast whether to assign a int. #include <stdio.h> void main() { float r; r…
-
3
votes1
answer425
viewsHow does Python handle static and dynamic variables?
Static variable, is the one where we separate the memory of the computer already defined beforehand (I read this in the book "Basic data structure"). The dynamic variable, on the other hand, is one…
-
3
votes2
answers118
viewsWhat is the difference between getRating() and getProgress()?
According to the documentation getProgress returns the level of progress of the rating bar, while getRating returns the number of stars of the rating bar. So in general terms getProgress returns a…
-
3
votes1
answer141
viewsWhat gains do I get in specifying the type of a function’s argument?
It is now possible to define the type of argument that a function will receive. See this small illustration example: def soma1(v1: int, v2: int): return v1 + v2 def soma2(v1, v2): return v1 + v2…
-
3
votes3
answers559
viewsHow to know the type of a variable in Kotlin?
What is the function to know the type of a variable? ex: var a = "teste" print(a.type()) output: String
-
3
votes1
answer1797
viewsHow to use the if block with variable types in Python?
I am creating a program in Python and need that necessarily the data of the ID field are integer numbers. Basically I want to enter the block if depending on the type of variable I get. Example: ID…
-
3
votes1
answer588
viewsHow to start an object in Typescript without declaring all properties at once?
Taking into account the following interface: interface Usuario { nome: string; senha: string; email: string; } It is possible to declare an object "slowly" without creating a new type or interface…
-
3
votes1
answer56
viewsHow to declare that a camp has the same kind of class?
I am trying to add typing to the Python code, and I came across an error when trying to annotate the type of a property that must have the same type of class in which it is declared: from typing…
-
2
votes1
answer849
viewsData conversion in types such as int and double
I’m having trouble making data conversions from a database, for example I perform a query to the bank like this: carteira ca = bc.carteira.FirstOrDefault(obj => obj.cpf == cepf &&…
-
2
votes1
answer111
viewsHow to identify the type of data the user typed in a prompt or input?
I started studying JS 3 weeks ago and am well apprenticed... My biggest current duplicitous is that I don’t know an operator or command to identify and condition the value of the data type entered…
-
2
votes1
answer768
viewsUnexpected value is being displayed
Do a program that receives the number of hours worked, the value of the minimum wage and the number of overtime worked, calculate and show the salary you receive, following the rules below: a. The…
-
2
votes1
answer2332
viewsHow to break strings on more than one line without concatenating?
Whenever you need to write something very soon in a string in Javascript I need to concatenate, something like: var str = 'foo bar foo bar foo bar foo bar foo bar foo bar' + 'foo bar foo bar foo bar…
-
2
votes2
answers156
viewsError: Cannot find data type long
I am trying to create a precedent in SQL Server 2012, but it is giving the following error in signing it. Mensagem 2715, Nível 16, Estado 3, Procedimento MINHAPROCEDURE, Linha 6 Column, parameter,…
-
2
votes2
answers864
views -
2
votes2
answers105
viewsWhat would be a parameter call before the string in a function
I’ve seen it done over and over again: interface LoggerAwareInterface { public function setLogger(LoggerInterface $logger); } Put a parameter before the variable, in which case what it would be and…
-
2
votes2
answers56
viewsField of type time or decimal, how to solve?
I have in the system that I am developing a field called flow, which can be filled either with a decimal value like 0.5 and 2.4 or with a value of time, like 15 min and 5 h. What is the best…