Click here to Skip to main content
15,886,963 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
NewsJava 18 brings new features to accelerate software development Pin
Kent Sharkey22-Mar-22 7:01
staffKent Sharkey22-Mar-22 7:01 
NewsNew Browser-in-the Browser (BitB) attack makes phishing nearly undetectable Pin
Kent Sharkey22-Mar-22 7:01
staffKent Sharkey22-Mar-22 7:01 
NewsGet ready for the death of Internet Explorer 11 Pin
Kent Sharkey21-Mar-22 10:16
staffKent Sharkey21-Mar-22 10:16 
GeneralRe: Get ready for the death of Internet Explorer 11 Pin
Marc Clifton21-Mar-22 10:27
mvaMarc Clifton21-Mar-22 10:27 
GeneralRe: Get ready for the death of Internet Explorer 11 Pin
#realJSOP21-Mar-22 23:42
mve#realJSOP21-Mar-22 23:42 
NewsPlease put units in names Pin
Kent Sharkey21-Mar-22 10:16
staffKent Sharkey21-Mar-22 10:16 
GeneralRe: Please put units in names Pin
Marc Clifton22-Mar-22 8:25
mvaMarc Clifton22-Mar-22 8:25 
GeneralRe: Please put units in names Pin
trønderen22-Mar-22 10:23
trønderen22-Mar-22 10:23 
In the 1960s and 70s, maybe a little into the 1980s, fierce language discussions raged. Lots of ideas where quite different from what we know today - i.e. the syntax was not just 'C with a twist', they could be very different. Look at Lisp, APL, Forth, ... Semantics could be of a different world, such as in Prolog and SNOBOL.

One aspect heavily discussed was including units as a first class citizen (along with e.g. type, value, ...). In most proposals, this would be an extension to a type definition, telling which unit tokens are permitted with literals of this type - none not being an option. For all practical purposes, you may consider a unit a multiplication factor applied to a literal, but you would not specify it in absolute terms but relative to other units. Say, if you declare a type float unit m; you could define supplementary unit km = 1000 m, mm = 0.001 m, in = 0.0254 m, mile = 1609.344 m and so on. A valid expression might be like totalDistance = 3 km + 2 mi;

If a type was associated with a unit, you would always have to specify the unit with a literal. For output formatting, you would have to specify the desired unit(s). Some of the proposals for unit handling also included cross-type units, e.g. a type float area unit sqm; you could define a unit m*m; (assuming that m is a defined distance unit); so that area lot = 30 m * 50 m; would be valid, giving lot the value 1500 sqm.

Long ago, I read some quite fierce argumentation favoring or rejecting the inclusion of units in the Algol 68 language. As far as I know, it was finally rejected. I have seen other discussions relating it to other languages, and to the general concept regardless of language. All of that is years back - so long ago that I certainly have no internet link to the discussions. I haven't hear any reference to it for a long, long time.

I must admit that I always thought of it as a great idea. It is a pity that it has been "forgotten", at least as far as I know. I am not aware of any language providing units as a first class citizen. I have written code emulating it, defining constants for the units, so that I can write totalDistance = 3*km + 2*mi; but the star is ugly (here!), and I have no compiler support for always requiring a unit and for limiting the units to those valid for the type.

A language implementing a unit system of this kind would be a more than a complete answer to the author's complaints. After all: He had to pick his examples from three different languages, three ecosystems. If Python is consistent on always measuring time in seconds, Java consistent on always measuring in milliseconds and Haskell in microseconds, all time values would have the same unit blurb attached - which is rather redundant. A unit system would allow the parameter to be given as 300 sec, 300 ms or 300 us in either system (obviously, assuming that sec, ms and us are defined time units).

Actually, I would consider this to be a far more valuable extension to a future C# version than some of the 'features' that have been added in the last few revisions!

modified 22-Mar-22 16:51pm.

GeneralRe: Please put units in names Pin
Bernhard Hiller22-Mar-22 21:30
Bernhard Hiller22-Mar-22 21:30 
NewsSuffer from Ctrl+S fatigue? We have a feature for you Pin
Kent Sharkey21-Mar-22 10:01
staffKent Sharkey21-Mar-22 10:01 
GeneralRe: Suffer from Ctrl+S fatigue? We have a feature for you Pin
Dan Neely22-Mar-22 3:17
Dan Neely22-Mar-22 3:17 
NewsSoftware lasts half a year: Why software development is a never-ending process Pin
Kent Sharkey21-Mar-22 9:01
staffKent Sharkey21-Mar-22 9:01 
GeneralRe: Software lasts half a year: Why software development is a never-ending process Pin
MarkTJohnson21-Mar-22 9:32
professionalMarkTJohnson21-Mar-22 9:32 
GeneralRe: Software lasts half a year: Why software development is a never-ending process Pin
#realJSOP21-Mar-22 23:52
mve#realJSOP21-Mar-22 23:52 
GeneralRe: Software lasts half a year: Why software development is a never-ending process Pin
Dan Neely22-Mar-22 3:24
Dan Neely22-Mar-22 3:24 
GeneralRe: Software lasts half a year: Why software development is a never-ending process Pin
#realJSOP24-Mar-22 0:26
mve#realJSOP24-Mar-22 0:26 
GeneralRe: Software lasts half a year: Why software development is a never-ending process Pin
obermd22-Mar-22 4:05
obermd22-Mar-22 4:05 
NewsIs the Metaverse even feasible? Pin
Kent Sharkey21-Mar-22 9:01
staffKent Sharkey21-Mar-22 9:01 
NewsWindows needs a change in priorities Pin
Kent Sharkey21-Mar-22 9:01
staffKent Sharkey21-Mar-22 9:01 
GeneralRe: Windows needs a change in priorities Pin
David O'Neil21-Mar-22 21:12
professionalDavid O'Neil21-Mar-22 21:12 
NewsNew Linux kernel bolsters random number generation Pin
Kent Sharkey21-Mar-22 9:01
staffKent Sharkey21-Mar-22 9:01 
NewsMicrosoft investigating claims of hacked source code repositories Pin
Kent Sharkey21-Mar-22 8:16
staffKent Sharkey21-Mar-22 8:16 
NewsPerformance benefits of sealed class in .NET Pin
Kent Sharkey21-Mar-22 8:01
staffKent Sharkey21-Mar-22 8:01 
GeneralRe: Performance benefits of sealed class in .NET Pin
Dan Neely22-Mar-22 3:21
Dan Neely22-Mar-22 3:21 
NewsMicrosoft makes it easier to play audio CDs in Windows 11 Pin
Kent Sharkey20-Mar-22 10:46
staffKent Sharkey20-Mar-22 10:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.