[{"data":1,"prerenderedAt":530},["ShallowReactive",2],{"project-38276430":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":43,"post_text":47,"what":48,"said":74,"maker_in_thread":192,"shape":203,"grid":208,"attempts":493,"same_week":494,"maker_shows":362,"maker_hidden":522,"reader_version":523,"card":524},"38276430","Numbat","A programming language with physical dimensions as types","title","Show HN: Numbat – A programming language with physical dimensions as types","https:\u002F\u002Fnumbat.dev\u002Farticles\u002Fintro.html","numbat.dev","sharkdp",1700055297,2023,146,113,429,3109,14,"notable","languages","programming language","cli",[24,25,26,27],"physical dimensions","units of measure","type system","unit conversion","curious",0.038,{"positive":31,"neutral":32,"mixed":33,"critical":31},9,20,0,38,{"design":36,"idea":38,"execution":41,"docs":42},{"positive":37,"critical":37},1,{"positive":39,"critical":40},3,8,{"positive":33,"critical":33},{"positive":37,"critical":33},[37,33,39,33,33,39,39,44,39,33,37,37,33,33,37,45,45,37,46,39,39,33,39,33,45,45,33,45,33,33,33,33,33,33,45,37,33,33,37,33],2,5,4,null,{"problem":49,"audience":47,"pricing":47,"motivation":47,"time_to_build":47,"stack":59,"openness":71,"stage":72,"team_size":73},{"value":50,"source":51,"evidence":52},"Catches unit errors by treating physical dimensions as static types","maker",[53,56],{"id":54,"by":11,"text":55},"38294855","Thank you for the reference. I hadn't seen Unchained. You missed the point about this example though. I wanted to show how Numbat can help prevent the exact error that you made…",{"id":57,"by":11,"text":58},"38294823","I looked at Julia and Unitful.jl quite a bit when designing Numbat. It looks great. > Extending it to cover all of Numbat's functionality could be trivially accomplished in a few…",[60,67],{"value":61,"source":62,"evidence":63},"Rust","inferred",[64],{"id":65,"by":11,"text":66},"38296242","Yes. If you want to know more, you can read about it here: https:\u002F\u002Fgithub.com\u002Fsharkdp\u002Fnumbat\u002Fblob\u002Fmaster\u002Fassets\u002Freasons-for-rewriting-in-rust.md",{"value":68,"source":51,"evidence":69},"WebAssembly",[70],{"id":57,"by":11,"text":58},"open_source","launched","unknown",{"praise":75,"objections":95,"requests":121,"questions":133,"alternatives":155},[76,84],{"value":77,"source":78,"evidence":79},"Clear, well-written introduction article","commenter",[80],{"id":81,"by":82,"text":83},"38299423","SuperNinKenDo","Still reading the article, and really intrigued by and love this idea. But can I just say that I find this intro extremely well written. I feel like the writer is reading my…",{"value":85,"source":78,"evidence":86},"Type-checked units are a useful idea",[87,91],{"id":88,"by":89,"text":90},"38291122","Aspos","This is great. I want this as an addon to JS and Python.",{"id":92,"by":93,"text":94},"38292833","cosmojg","Super cool! I love when programming languages try to do more with types. Julia has a neat little library called Unitful.jl[1] which does almost exactly what Numbat does by taking…",[96,111],{"value":97,"source":78,"evidence":98},"Month and year units are averaged constants, which can mislead",[99,103,107],{"id":100,"by":101,"text":102},"38291676","wwalexander","A month cannot be unambiguously represented as a length of time, as the length of a month is variable.",{"id":104,"by":105,"text":106},"38295011","merelysounds","Impressive! One thing I find unintuitive is the implementation of variable length units (like months or years) as an averaged constant. Then again, perhaps that’s the point - and…",{"id":108,"by":109,"text":110},"38291849","manifoldgeo","How does something like `let y: Time = 1 year` work? Does it take into consideration the idea of leap years and leap seconds, counting a single year as 365.2422 days[0]? Or does…",{"value":112,"source":78,"evidence":113},"Linear algebra with mixed units is not handled yet",[114,118],{"id":115,"by":116,"text":117},"38293741","kragen","the classic problem for such number systems is linear algebra https:\u002F\u002Fyosefk.com\u002Fblog\u002Fcan-your-static-type-system-handle-linear-algebra.html the issue is that each column and…",{"id":119,"by":116,"text":120},"38295335","most linear algebra requires vectors of multiple unit types. think of runge-kutta for a second-order system, for example, or just about any multivariate system. see…",[122,126],{"value":123,"source":78,"evidence":124},"Aggregate types such as vectors and matrices",[125],{"id":115,"by":116,"text":117},{"value":127,"source":78,"evidence":128},"Date arithmetic relative to today",[129],{"id":130,"by":131,"text":132},"38292483","indentit","Can it be used as a date calculator? I didn't see a way to specify \"today\" or \"tomorrow\". Like \"today\" + 14 days etc.",[134,145],{"value":135,"source":78,"evidence":136},"How are calendar and sidereal time units distinguished",[137,141],{"id":138,"by":139,"text":140},"38293186","vlovich123","I feel like that’s unit confusion. Converting from year to day should require you to specify what calendar year you’re in to resolve the ambiguity. Otherwise I set an alarm for…",{"id":142,"by":143,"text":144},"38299862","techdragon","Ok so I did some reading and I like what I see, its important however to properly disambiguate between the two kinds of time units. Chronological Time units and Calendrical Time…",{"value":146,"source":78,"evidence":147},"How are transcendental functions typed",[148,152],{"id":149,"by":150,"text":151},"38291613","jskherman","How does Numbat infer the type\u002Funit for operations that involve transcendental functions like the trigonometric functions and the natural logarithm? How about for exponents that…",{"id":153,"by":11,"text":154},"38294179","You don't have to convert to scalars. Numbers have a type of 1 (= Scalar). You can just call exp(3), for example: https:\u002F\u002Fnumbat.dev\u002F?q=exp%283%29%E2%8F%8E Or you could pass an…",[156,167,171,178,185],{"value":157,"source":78,"evidence":158},"Frink",[159,163],{"id":160,"by":161,"text":162},"38293411","joeatwork","If I’m reading this correctly, the Frink language has similar features (and also seems darn useful!) https:\u002F\u002Ffrinklang.org\u002F",{"id":164,"by":165,"text":166},"38293423","thesuperbigfrog","Frink (https:\u002F\u002Ffrinklang.org\u002F) is an older language with similar design goals. Frink runs on the JVM and is also available on Android. I use it as a general purpose calculator on…",{"value":168,"source":78,"evidence":169},"Unitful.jl",[170],{"id":92,"by":93,"text":94},{"value":172,"source":78,"evidence":173},"F# Units of Measure",[174],{"id":175,"by":176,"text":177},"38291135","evntdrvn","I can't resist mentioning F# Units of Measure aka UoM :) https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Ffsharp\u002Flanguage-reference\u002Funits-of-measure",{"value":179,"source":78,"evidence":180},"GNU Units",[181],{"id":182,"by":183,"text":184},"38292970","hsfzxjy","Remind me of GNU Units https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Funits\u002F",{"value":186,"source":78,"evidence":187},"Unchained (Nim)",[188],{"id":189,"by":190,"text":191},"38292060","V1ndaar","Or you could just use Nim [0], where this sort of thing can be implemented in Nim's macro system. Then you have a regular programming language combined with CT safe units. :) It…",{"comments":18,"answered":37,"key":193},[194,197,200],{"id":195,"text":196},"38295042","So 'year' refers to the Gregorian year and is equal to 365.243 days [1]. We also have 'julian_year' which is equal to '365.25 days'. We also have 'sidereal_day' equal to '23.9345…",{"id":198,"text":199},"38296274","> 365·243 ought to be 365·2425 exactly: Yes. This is also how it is defined:…",{"id":201,"text":202},"38294280","> As a physicist, if you ever see units on the parameter to a trigonmetric function, you can be fairly certain something is wrong. Exactly. Which is why trigonometric functions…",{"commenters":204,"max_depth":205,"maker_replies":18,"first_comment_mins":206,"lifespan_hours":207},63,12,53,150,[209,211,213,217,220,222,224,225,229,232,234,236,238,240,243,247,248,250,251,254,257,260,263,266,267,270,273,275,276,277,279,281,284,287,289,291,293,295,297,299,301,303,304,307,311,313,317,320,324,327,328,332,334,337,340,342,346,348,351,354,356,360,364,367,370,372,374,376,378,381,384,389,393,395,398,401,404,406,408,409,412,413,415,417,418,420,422,424,426,428,430,433,435,437,439,442,445,447,449,451,455,459,462,464,467,469,472,475,478,482,485,488,491],[108,33,39,210,109,33],"project\u002Fneutral\u002Fdesign",[138,33,37,212,139,33],"project\u002Fcritical\u002Fidea",[214,33,33,215,216,33],"38294125","commenter\u002Fneutral\u002Fidea","SenAnder",[218,33,33,215,219,33],"38294457","thriftwy",[195,33,33,221,11,37],"project\u002Fneutral\u002Fidea",[223,33,39,221,219,33],"38296222",[142,33,39,221,143,33],[226,33,33,227,228,33],"38302260","other\u002Fneutral\u002Fnone","joshuanapoli",[230,33,33,231,143,33],"38305588","commenter\u002Fneutral\u002Fnone",[233,33,33,227,228,33],"38322893",[235,33,33,227,219,33],"38325391",[237,33,33,227,228,33],"38348195",[239,33,33,227,219,33],"38368617",[241,33,33,227,242,33],"38293968","peheje",[244,33,39,245,246,33],"38296093","project\u002Fneutral\u002Fexecution","agalunar",[198,33,33,245,11,37],[249,33,33,231,246,33],"38296605",[149,37,39,221,150,33],[252,37,39,210,253,33],"38291996","iNic",[255,37,37,256,150,33],"38292122","project\u002Fcritical\u002Fdesign",[258,37,39,210,259,33],"38292834","geysersam",[261,37,39,210,262,33],"38293061","xigoi",[264,37,39,210,265,33],"38293831","marginalia_nu",[201,37,33,210,11,37],[268,37,39,210,269,33],"38294291","pklausler",[271,37,33,231,272,33],"38294448","mikewarot",[274,37,33,231,265,33],"38294480",[153,37,33,210,11,37],[115,44,37,212,116,33],[278,44,33,210,11,37],"38294397",[280,44,33,231,116,33],"38295356",[282,44,37,212,283,33],"38294621","spott",[285,44,37,212,286,33],"38294768","adastra22",[288,44,33,215,283,33],"38299080",[290,44,33,215,286,33],"38300281",[292,44,33,215,116,33],"38305518",[294,44,33,231,286,33],"38309201",[296,44,33,215,116,33],"38308119",[298,44,33,215,116,33],"38295379",[160,39,33,300,161,33],"other\u002Fneutral\u002Fidea",[302,39,33,300,11,37],"38294195",[100,46,37,212,101,33],[305,46,39,221,306,33],"38291874","michaelcampbell",[308,46,45,309,310,33],"38294411","project\u002Fpositive\u002Fnone","aimor",[81,45,45,312,82,33],"maker\u002Fpositive\u002Fdocs",[314,315,45,309,316,33],"38293555",6,"exp1orer",[318,315,33,319,11,37],"38294550","project\u002Fneutral\u002Fnone",[321,322,45,309,323,33],"38294820",7,"nutate",[325,40,39,221,326,33],"38291489","enbugger",[104,31,37,212,105,33],[329,31,45,330,331,33],"38297772","project\u002Fpositive\u002Fidea","ttkciar",[130,333,39,221,131,33],10,[335,333,39,221,336,33],"38292894","BasilPH",[338,333,33,227,339,33],"38294165","JNRowe",[341,333,33,231,131,33],"38299010",[343,344,39,319,345,33],"38296229",11,"benhurmarcel",[65,344,33,347,11,37],"project\u002Fneutral\u002Fdocs",[349,205,39,221,350,33],"38293334","praveen9920",[352,205,39,319,353,33],"38293936","eminence32",[355,205,33,319,11,37],"38294576",[357,205,33,358,359,33],"38295380","commenter\u002Fcritical\u002Fidea","freistil",[361,362,33,227,363,33],"38294775",13,"mlhpdx",[365,18,39,319,366,33],"38291418","runamuck",[368,18,39,319,369,33],"38291870","bertil",[371,18,33,227,366,33],"38303545",[373,18,33,227,369,33],"38304429",[375,18,33,227,366,33],"38308086",[88,377,45,330,89,33],15,[379,377,33,227,380,33],"38291989","seanos",[382,377,33,227,383,33],"38292054","jsiva",[385,386,45,387,388,33],"38300399",16,"project\u002Fpositive\u002Fdesign","eviks",[390,391,39,221,392,33],"38293811",17,"youssefabdelm",[175,394,33,227,176,33],18,[396,394,33,227,397,33],"38291409","stiiv",[399,394,33,227,400,33],"38291767","openquery",[402,394,33,227,403,33],"38293532","nritchie",[405,394,33,330,11,37],"38294350",[92,407,45,330,93,33],19,[57,407,33,330,11,37],[410,407,33,231,411,33],"38302985","ChrisRackauckas",[189,32,33,300,190,33],[414,32,33,227,116,33],"38293782",[416,32,33,227,190,33],"38295299",[119,32,33,231,116,33],[419,32,33,231,190,33],"38300854",[421,32,33,231,116,33],"38305452",[423,32,33,231,190,33],"38308114",[425,32,33,231,116,33],"38308302",[54,32,33,427,11,37],"maker\u002Fneutral\u002Fidea",[429,32,33,231,190,33],"38295235",[431,32,33,432,388,33],"38300503","other\u002Fneutral\u002Fdesign",[434,32,33,432,190,33],"38300721",[436,32,33,432,388,33],"38301287",[164,438,33,227,165,33],21,[440,438,33,227,441,33],"38293701","nerdponx",[443,438,33,444,11,37],"38294879","maker\u002Fneutral\u002Fnone",[446,438,33,227,11,37],"38294889",[448,438,45,309,165,33],"38295474",[182,450,33,227,183,33],22,[452,453,33,227,454,33],"38293111",23,"docandrew",[456,457,37,212,458,33],"38291498",24,"pif",[460,457,33,231,461,33],"38291566","antoineMoPa",[463,457,33,227,458,33],"38291635",[465,457,33,227,466,33],"38291646","n_plus_1_acc",[468,457,33,227,466,33],"38291663",[470,457,33,227,471,33],"38293240","leakim",[473,457,33,474,139,33],"38293363","other\u002Fcritical\u002Fperformance",[476,457,37,212,477,33],"38294465","adamdegas",[479,480,33,227,481,33],"38276915",25,"jqpabc123",[483,480,33,227,484,33],"38288894","gus_massa",[486,480,33,487,481,33],"38291359","commenter\u002Fcritical\u002Fnone",[489,480,33,231,490,33],"38291704","davidcuddeback",[492,480,33,487,484,33],"38303244",[],[495,500,505,509,513,517],{"id":496,"name":497,"points":498,"category":499},"38243949","dpoint",583,"hardware",{"id":501,"name":502,"points":503,"category":504},"38230325","Spray",393,"dev_tools",{"id":506,"name":507,"points":508,"category":20},"38228788","DataSheetGrid",342,{"id":510,"name":511,"points":512,"category":20},"38202703","BabaBASIC",234,{"id":514,"name":515,"points":516,"category":504},"38230476","Flyscrape",208,{"id":518,"name":519,"points":520,"category":521},"38236198","bulk_transcribe_youtube_videos_from_playlist",125,"ai",false,"v2",{"id":525,"name":5,"line":6,"ai":522,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":526,"top":18,"kw":527,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":528,"url":9,"mix":529,"praise":77,"objection":97,"sub":21},38276430,0.04,[24,25,26,27],"1030033230110015514330305505000000510010",[31,32,33,31],1794036644702]