Questions tagged [types]
Types, and type systems, are used to enforce levels of abstraction in programs.
types
28,919
questions
0
votes
2
answers
56
views
How to fix column with numeric values that is taken as a string field because of empty strings in Pandas dataframe?
I have a df with some columns that are supposed to be numeric fields. However, there are empty strings existing in these columns, which leads to their data being incorrectly assigned as 'object'. How ...
0
votes
0
answers
25
views
How does the type of attributes of UserRepresentation in Keycloak look like?
In the Keycloak documentation, it just shows that the type of attributes is Map of [array]. There is no illustration.
For a Java Map<K, V>, how does the Map of [array] look like, i.e. what're ...
0
votes
2
answers
68
views
Static variable and type: could there be another simpler way to implement a function that returns the same ID for each user-defined type?
I was working on creating an entity-component system on my own, and in doing this I have gotten help from a lot of YouTube videos, C++ references, recommended books, etc. While I was implementing a ...
0
votes
1
answer
50
views
How to create a custom type to parse [u8;32] from a json that contains a hex string in Rust
Given the next json:
[
{
"dataValueArray": ["0xa4bfa0908dc7b06d98da4309f859023d6947561bc19bc00d77f763dea1a0b9f5"],
"dataValue": "...
0
votes
2
answers
93
views
Constrain return type to be subtype of this
I have the following interface:
internal interface ITyped<EnumType> where EnumType : struct, Enum
{
public EnumType Type { get; }
// !!! this method must always return a subtype* of the ...
1
vote
0
answers
18
views
Why does TypeScript Type Inference Fail with Unimplemented Interface Method? [duplicate]
I have two TypeScript examples where I'm trying to ensure that a parameter type (Param) is inferred as string.
In the first example, it is inferred as string as expected. But in the second, it is ...
0
votes
0
answers
15
views
Solidity: invalid BigNumber string
Say I wanted to create a slightly modified ERC-721, which tracked its historical metadata states. Something like so:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import { ERC721 } from &...
0
votes
1
answer
81
views
Compile time map of type string name to types in C++
In C++ is it possible to generate a compile time map of stringified type names to types. I am aware types themselves can't be mapped but could we for example map to template metafunctions which expose ...
1
vote
1
answer
95
views
NumPy array size and performance differences for int8 vs bool dtype
I am trying to use numpy's nbytes attribute to examine the memory usage of arrays with different dtype. I noticed the following:
>>> np.zeros(1024, dtype='int64').nbytes / 1024 # in kB
8.0
...
0
votes
1
answer
24
views
Reusing overloaded parameter definitions for functions with different returns
I have two functions which have the same overloading of parameters but return different things. Is there someway I can abstract the overloading definition into a shared definition that I can reference ...
-1
votes
2
answers
53
views
What is the strict type for the below code in angular
const componentMapper = {
input: InputComponent,
button: ButtonComponent,
select: SelectComponent,
date: DateComponent,
radiobutton: RadiobuttonComponent,
checkbox: CheckboxComponent,
...
0
votes
0
answers
40
views
How to decode dictionary of dictionaries with NSSecureCoding
I have an existing iOS app with years of serialization using NSCoding. As NSCoding is deprecated in favor of NSSecureCoding, I'm switching over. Most data has been very straightforward, but I can't ...
1
vote
1
answer
147
views
Calculating numbers that require greater than 16 byte data type in C++
I'm working on a function to calculate Fibonacci numbers and return the lowest value digit of that number in C++. I've found that in C++, the largest data type is __uint128_t, which gives me 16 bytes ...
1
vote
3
answers
185
views
Type 'string | boolean' is not assignable to type 'never' in typescript
Consider this class:
const creditRiskRatingKeys = [
'applicant_id',
'is_dirty',
] as const;
const dict = {
applicant_id: 'test_id',
is_dirty: true,
}
class CreditRiskRating {
applicant_id:...
1
vote
2
answers
101
views
Why does the int type change size based on processor architecture while other types do not?
I am studying coding conventions and came across a rule that advises against using the int type. I believe this stems from the characteristic of the int type, which dynamically changes its size based ...