Skip to main content

Questions tagged [types]

Types, and type systems, are used to enforce levels of abstraction in programs.

types
0 votes
0 answers
5 views

R visNetwork arrow type

The below code is meant to yield the following network graph: . library(visNetwork) library(magrittr) nodes <- data.frame(id=c("a","b","c","d"), label=c(&...
jbowerbir's user avatar
1 vote
3 answers
53 views

In C, why can a variable holding a char array be assigned to a pointer, but the address of the same pointer cannot?

Consider the following code: char stringy[] = "There's too much confusion, I can't get no relief!"; char *pStringy; pStringy = stringy; This compiles - stringy is an array of characters, ...
Bennypr0fane's user avatar
0 votes
1 answer
44 views

Write a new Delphi type that lets a method have inline code as a parameter?

Is it possible to have this in Delphi? DoThis(ShowMessage('SomeMsg ..'); Caption := 'SomeCaption'; Inc(I)); Is it possible to create a new type that handles inline code like this? For example, we ...
MBen's user avatar
  • 19
-2 votes
0 answers
11 views

What should I prefer input type for voice synthesis [closed]

I decide to make my artificial neural network for synthesis my voice but still I am not sure about what I use for input type. Should I use input type as letter or syllable? I still not start the ...
Yunus's user avatar
  • 1
1 vote
1 answer
35 views

R get local variable from formula

Consider the R code : foo <- function(formula){ Y <- get(formula[[2]]) print(Y) } main <- function(){ Y <- 1 X <- 2 foo(Y ~ X) } main() The outcome says that in get(...
温泽海's user avatar
  • 342
0 votes
0 answers
21 views

check if given object implements certain generic interface; type argument(s) NOT known [duplicate]

I have some object. I want to check at runtime if it is an IReadOnlyCollection<T> of any T, i.e. I cannot specify that T in my check. So it should return true for e.g. IReadOnlyCollection<...
Kjara's user avatar
  • 2,752
0 votes
0 answers
26 views

As a wrapper object in JavaScript, why can not use 'new' to create a BigInt in JavasScript? [duplicate]

There are 5 wrapper objects in JavaScript: Number, BigInt, String, Boolean, and Symbol.You can use 'new' to create a Number, String, Boolean, Symbol. But you can not use 'new' to create a BigInt. what ...
Leo qiao's user avatar
-2 votes
0 answers
75 views

Are there objects for primitive data types? [duplicate]

If the object represents a data type, is the variable for a primitive data type like an integer also an object representing this type, or do objects not represent primitive data types? // Let's assume ...
Ahmed Hamed's user avatar
0 votes
0 answers
36 views

Why print(f"{variable = }") in Python 3.12 also prints numpy type?

I noticed, that with Python 3.12 and a numpy.float64 when I simply do a x = numpy.sqrt(3) # type is <class 'numpy.float64'> now print(f"{x = }") # this is printed >>>x = np....
emefff's user avatar
  • 1
0 votes
1 answer
51 views

How to enforce error on impossible switch case?

There is a linter we can enable for equality check. What about switch case ? This does not seem to work. https://stackoverflow.com/a/78736339/6727914 How to convert the warning into errors ? Example: ...
TSR's user avatar
  • 19.4k
-1 votes
0 answers
59 views

Why doesn't a type switch case with multiple types assign the detected type to the variable? [closed]

In Go, I want to understand some design choices in the type switch. The following example works as expected: package main import "fmt" func abs[T int | float64](a T) T { if a >= 0 { ...
Kpym's user avatar
  • 3,919
3 votes
1 answer
57 views

How to enforce error on impossible equality check?

There is a linter to it https://dart.dev/tools/linter-rules/unrelated_type_equality_checks but it just shows a warning, rendering it almost useless for large projects. How to convert the warning into ...
TSR's user avatar
  • 19.4k
-1 votes
1 answer
55 views

Go type assertion (any) [duplicate]

This seems likely to be a duplicate but I couldn't find a solution. Please point me in the right direction if it is a duplicate I am relatively new to Go and here I am trying to create a helper ...
Emil's user avatar
  • 390
1 vote
0 answers
15 views

Why am I having an issue with typescript and Prisma ORM when trying to find a unique item?

I am having issues with my ability to use the prisma .findUnique() function call. My code doesn't show any compilation error, but when I actually try to go to a product page it causes a runtime error. ...
The Elina's user avatar
0 votes
1 answer
21 views

Checking subclass against metaclass type

I have a set of plugins that inherit from a metaclass. the metaclasss is defined like so: from abc import ABC, abstractmethod class MetaReader(ABC): def __init__(self, arg1, arg2, **kwargs): ...
KBriggs's user avatar
  • 1,338

15 30 50 per page
1
2 3 4 5
1931