Path: csiph.com!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: comp.lang.c Subject: Re: Safety of casting from 'long' to 'int' Date: Fri, 8 May 2026 14:55:29 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <10tkth1$9ub$1@reader1.panix.com> References: <10su8cn$am9i$1@dont-email.me> <10tie4h$1l93l$1@dont-email.me> <10tiu79$obc$1@reader1.panix.com> <10tivmm$1l93l$5@dont-email.me> Injection-Date: Fri, 8 May 2026 14:55:29 -0000 (UTC) Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="10187"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross) Xref: csiph.com comp.lang.c:398494 In article <10tivmm$1l93l$5@dont-email.me>, Janis Papanagnou wrote: >On 2026-05-07 22:55, Dan Cross wrote: >> [**Warning:** Not C. Ignore if you don't care] >> >> In article <10tie4h$1l93l$1@dont-email.me>, >> Janis Papanagnou wrote: >>> On 2026-05-07 17:36, Dan Cross wrote: >>>> [snip] >>>> It was clearly inspired >>>> by (at least) ML, which is a sound basis for a language design. >>> >>> I can't tell about ML, but from earlier posts of Bart I'd have guessed >>> it was rather from Algol 68, and a statement on these pages seems to >>> confirm that: "This was heavily inspired by Algol68, but with a number >>> of differences [...]" >> >> To get a taste for the flavor of SML, you may find >> https://www.cs.cmu.edu/~rwh/isml/book.pdf interesting. > >Thanks, I might have a look into it. > >> >> The Fibonacci example that in this "M" language is: >> >> |func fib(n)= >> | if n<3 then >> | 1 >> | else >> | fib(n-1)+fib(n-2) >> | fi >> |end > >That would be in Algol 68 (modulo any unintended typing errors) > > PROC fib = (INT n) INT : > IF n < 3 THEN > 1 > ELSE > fib (n-1) + fib (n-2) > FI Ah, so almost the same. >with the notable difference of arguments and result being typed. I suspect his is typed as well; just that the default type is `int` so it's unnecessary to specify it. >> [sic: as a sequence, the Fibonacci numbers are undefined for >> $n<0$, but this is a pedagogical example, so let's ignore that] > >> [ a lot samples snipped ] > >(The 'let' keyword I find quite annoying. But okay, just a detail.) I find SML a bit verbose. The original ML is closer to OCaml in syntax, and OCaml is a more succinct. >> Anyway, I digress; the point is that one can see some syntatic >> similarities. > >Sure. There's not much options I suppose, Oh, I don't know about that; there are many! >and maybe this "M" or ML >was also influenced by Algol 68? Although Wikipedia doesn't mention >it as "influenced by", but given that it's from the 1970's chances >are there; it's hard to believe that the Algol 68 definition would >have stayed unnoticed given who was internationally involved. Tracing influence at this level is always fraught. I would go as far as to say that there was _some_ influence there, and ML and Algol68 likely share some DNA. But that doesn't say all that much. Perhaps that influence, such as it was, was not conscious, or more than cursory, and after all, hamsters and humans share DNA, too. - Dan C.