Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post almost 3 years ago by r~~‭.

50 / 255
  • ‘This language doesn't have types’ and ‘This language only has one type’ are English sentences that communicate the same underlying concept: a typeless language doesn't have a way to distinguish categories of values from each other, either statically (before running the program) or dynamically (while running the program).
  • It's not entirely clear to me, but you or your friend might be conflating types (which are categories of values) with data structures (which are arrangements of data in memory that can store values). Basically all programming languages have data structures, because all programming languages need to represent values in some way if they want to have any practical use. How types interact with the data structures supported by the language will vary.
  • It sounds like you're familiar with JavaScript, so here's how that language breaks down: JavaScript has dynamic types, which is the feature that makes it possible for the language to throw a friendly error if you try to use a number as if it were a function. If JavaScript had static types, it would be possible for the language to tell you before it even starts running that your program tries to use a number as if it were a function. If JavaScript were truly typeless, using a number as a function would probably result in some random part of memory being ‘executed’, which would immediately crash the entire process. But even a hypothetical typeless JavaScript would let you create numbers and functions and objects and arrays that contain each other; those are data structures. The categories that the language groups them into, statically or dynamically, are types. If the language treats all values equally, it's typeless.
  • (A type *system* usually refers to the rules for how types are defined, checked, and related to each other. A language with types has a type system, even if it's an extremely basic one defining a fixed set of types which are not related in any way to each other. But more powerful type systems allow for complex types and complex rules for judging whether a program uses values of those types correctly. As a matter of terminology, whether we say a language ‘has types’ or ‘has a type system’ depends only on where we want to put emphasis: on the types themselves, or on the ways they interact and get checked.)
  • ‘This language doesn't have types’ and ‘This language only has one type’ are English sentences that communicate the same underlying concept: a typeless language doesn't have a way to distinguish categories of values from each other, either statically (before running the program) or dynamically (while running the program).
  • It's not entirely clear to me, but you or that person might be conflating types (which are categories of values) with data structures (which are arrangements of data in memory that can store values). Basically all programming languages have data structures, because all programming languages need to represent values in some way if they want to have any practical use. How types interact with the data structures supported by the language will vary.
  • It sounds like you're familiar with JavaScript, so here's how that language breaks down: JavaScript has dynamic types, which is the feature that makes it possible for the language to throw a friendly error if you try to use a number as if it were a function. If JavaScript had static types, it would be possible for the language to tell you before it even starts running that your program tries to use a number as if it were a function. If JavaScript were truly typeless, using a number as a function would probably result in some random part of memory being ‘executed’, which would immediately crash the entire process. But even a hypothetical typeless JavaScript would let you create numbers and functions and objects and arrays that contain each other; those are data structures. The categories that the language groups them into, statically or dynamically, are types. If the language treats all values equally, it's typeless.
  • (A type *system* usually refers to the rules for how types are defined, checked, and related to each other. A language with types has a type system, even if it's an extremely basic one defining a fixed set of types which are not related in any way to each other. But more powerful type systems allow for complex types and complex rules for judging whether a program uses values of those types correctly. As a matter of terminology, whether we say a language ‘has types’ or ‘has a type system’ depends only on where we want to put emphasis: on the types themselves, or on the ways they interact and get checked).

Suggested almost 3 years ago by deleted user