Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #121585 > unrolled thread
| Started by | Mr Flibble <leigh@i42.co.uk> |
|---|---|
| First post | 2025-02-11 23:22 +0000 |
| Last post | 2025-02-14 16:00 +0000 |
| Articles | 20 on this page of 63 — 11 participants |
Back to article view | Back to comp.lang.c++
Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-11 23:22 +0000
Re: Universal Compiler (neos) - Turing Completeness Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-11 15:46 -0800
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-12 08:12 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-12 10:53 +0100
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-12 10:06 +0000
Re: Universal Compiler (neos) - Turing Completeness Phillip <nntp@fulltermprivacy.com> - 2025-02-12 11:34 -0500
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-12 10:55 +0100
Re: Universal Compiler (neos) - Turing Completeness Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-12 02:47 -0800
Re: Universal Compiler (neos) - Turing Completeness Phillip <nntp@fulltermprivacy.com> - 2025-02-12 11:36 -0500
Re: Universal Compiler (neos) - Turing Completeness scott@slp53.sl.home (Scott Lurndal) - 2025-02-12 16:51 +0000
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-12 21:58 +0000
Re: Universal Compiler (neos) - Turing Completeness Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-12 15:00 -0800
Re: Universal Compiler (neos) - Turing Completeness James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-12 12:26 -0500
Re: Universal Compiler (neos) - Turing Completeness Phillip <nntp@fulltermprivacy.com> - 2025-02-13 00:00 -0500
Re: Universal Compiler (neos) - Turing Completeness James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-13 06:46 -0500
Re: Universal Compiler (neos) - Turing Completeness "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-02-12 13:58 -0800
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-12 22:00 +0000
Re: Universal Compiler (neos) - Turing Completeness Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-12 15:05 -0800
Re: Universal Compiler (neos) - Turing Completeness James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-13 17:34 -0500
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-14 09:48 +0100
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-14 13:25 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-15 10:15 +0100
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 14:37 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-15 15:50 +0000
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 15:53 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-15 16:33 +0000
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 16:35 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-15 17:00 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-15 17:47 +0100
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 16:52 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-15 17:02 +0000
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 17:04 +0000
Re: Universal Compiler (neos) - Turing Completeness Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-15 14:44 -0800
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 22:59 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-16 09:23 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-16 14:13 +0100
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-16 13:18 +0000
Re: Universal Compiler (neos) - Turing Completeness Michael S <already5chosen@yahoo.com> - 2025-02-16 17:01 +0200
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-16 16:17 +0100
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-16 16:44 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-16 16:09 +0100
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-16 16:47 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-17 08:11 +0100
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-16 16:41 +0000
Re: Universal Compiler (neos) - Turing Completeness Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-16 15:23 -0800
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-17 09:02 +0000
Re: Universal Compiler (neos) - Turing Completeness James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-16 11:30 -0500
Re: Universal Compiler (neos) - Turing Completeness James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-15 23:49 -0500
Re: Universal Compiler (neos) - Turing Completeness Phillip <nntp@fulltermprivacy.com> - 2025-02-15 11:54 -0500
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 17:00 +0000
Re: Universal Compiler (neos) - Turing Completeness Phillip <nntp@fulltermprivacy.com> - 2025-02-15 12:20 -0500
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 17:24 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-16 09:19 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-15 17:04 +0000
Re: Universal Compiler (neos) - Turing Completeness Mr Flibble <leigh@i42.co.uk> - 2025-02-15 17:16 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-16 14:31 +0100
Re: Universal Compiler (neos) - Turing Completeness Muttley@dastardlyhq.com - 2025-02-16 16:44 +0000
Re: Universal Compiler (neos) - Turing Completeness James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-14 13:40 -0500
Re: Universal Compiler (neos) - Turing Completeness antispam@fricas.org (Waldek Hebisch) - 2025-02-14 21:23 +0000
Re: Universal Compiler (neos) - Turing Completeness David Brown <david.brown@hesbynett.no> - 2025-02-15 10:09 +0100
Re: Universal Compiler (neos) - Turing Completeness antispam@fricas.org (Waldek Hebisch) - 2025-02-16 05:47 +0000
Re: Universal Compiler (neos) - Turing Completeness antispam@fricas.org (Waldek Hebisch) - 2025-02-14 15:14 +0000
Re: Universal Compiler (neos) - Turing Completeness Muttley@DastardlyHQ.org - 2025-02-14 16:00 +0000
Page 1 of 4 [1] 2 3 4 Next page →
| From | Mr Flibble <leigh@i42.co.uk> |
|---|---|
| Date | 2025-02-11 23:22 +0000 |
| Subject | Universal Compiler (neos) - Turing Completeness |
| Message-ID | <eomnqj9h74qlbaaeh3llfj2cskptgssg2l@4ax.com> |
Hi! I hope to achieve neos Turing Completeness in March during a two week holiday. Also, did you know that with neos you can mix code from different programming languages in the same source code file! That is all. /Flibble
[toc] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2025-02-11 15:46 -0800 |
| Message-ID | <877c5wnixf.fsf@nosuchdomain.example.com> |
| In reply to | #121585 |
Mr Flibble <leigh@i42.co.uk> writes:
> I hope to achieve neos Turing Completeness in March during a two week
> holiday.
>
> Also, did you know that with neos you can mix code from different
> programming languages in the same source code file!
That's a remarkable assertion.
I presume you're asserting that you can do this *and* the code will
execute correctly.
Are you saying that that's possible in your current implementation, or
that it's something you intend to implement in the future?
Does switching from one language to another require some kind of
explicit marker, or does neos figure it out? With what granularity?
If the latter, how does it know whether
size_t s = sizeof 'a';
is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)?
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Muttley@DastardlyHQ.org |
|---|---|
| Date | 2025-02-12 08:12 +0000 |
| Message-ID | <vohl5s$28cr6$1@dont-email.me> |
| In reply to | #121586 |
On Tue, 11 Feb 2025 15:46:52 -0800 Keith Thompson <Keith.S.Thompson+u@gmail.com> wibbled: > size_t s = sizeof 'a'; > >is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? Interesting, I didn't know C would return 4 (just tested it, it does). I could understand it if it was in double quotes and so was a pointer but what is the logic behind returning 4 for an explicit single byte character?
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2025-02-12 10:53 +0100 |
| Message-ID | <vohr21$295hm$1@dont-email.me> |
| In reply to | #121587 |
On 12/02/2025 09:12, Muttley@DastardlyHQ.org wrote: > On Tue, 11 Feb 2025 15:46:52 -0800 > Keith Thompson <Keith.S.Thompson+u@gmail.com> wibbled: >> size_t s = sizeof 'a'; >> >> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? > > Interesting, I didn't know C would return 4 (just tested it, it does). I > could understand it if it was in double quotes and so was a pointer but > what is the logic behind returning 4 for an explicit single byte character? > Character constants, like 'a', were found in the earliest days of C when everything that was a number was "int". So character constants, like all other C constants, were "int". This has remained unchanged - backwards compatibility is of huge importance in C. When C++ was young, the aim was to keep close compatibility with C when it did not interfere with other goals of the language. Having 'a' be of type "char", rather than "int", was important to C++ which now had overloading. So in C++, sizeof 'a' is always 1, while in C, sizeof 'a' is sizeof(int) - typically 4 on most modern architectures, but not necessarily.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@DastardlyHQ.org |
|---|---|
| Date | 2025-02-12 10:06 +0000 |
| Message-ID | <vohrs0$29fu1$1@dont-email.me> |
| In reply to | #121588 |
On Wed, 12 Feb 2025 10:53:05 +0100 David Brown <david.brown@hesbynett.no> wibbled: >On 12/02/2025 09:12, Muttley@DastardlyHQ.org wrote: >> On Tue, 11 Feb 2025 15:46:52 -0800 >> Keith Thompson <Keith.S.Thompson+u@gmail.com> wibbled: >>> size_t s = sizeof 'a'; >>> >>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? >> >> Interesting, I didn't know C would return 4 (just tested it, it does). I >> could understand it if it was in double quotes and so was a pointer but >> what is the logic behind returning 4 for an explicit single byte character? >> > >Character constants, like 'a', were found in the earliest days of C when >everything that was a number was "int". So character constants, like >all other C constants, were "int". This has remained unchanged - >backwards compatibility is of huge importance in C. > >When C++ was young, the aim was to keep close compatibility with C when >it did not interfere with other goals of the language. Having 'a' be of >type "char", rather than "int", was important to C++ which now had >overloading. Interesting. Fairly academic I suppose because I can't imagine any scenario in a C program where you'd so sizeof on a char literal instead of just hard coding a 1 though it could be a one way for the code to know if it had been compiled by a C or C++ compiler.
[toc] | [prev] | [next] | [standalone]
| From | Phillip <nntp@fulltermprivacy.com> |
|---|---|
| Date | 2025-02-12 11:34 -0500 |
| Message-ID | <voiijj$2cefi$1@dont-email.me> |
| In reply to | #121590 |
On 2/12/25 5:06 AM, Muttley@DastardlyHQ.org wrote: > On Wed, 12 Feb 2025 10:53:05 +0100 > David Brown <david.brown@hesbynett.no> wibbled: >> On 12/02/2025 09:12, Muttley@DastardlyHQ.org wrote: >>> On Tue, 11 Feb 2025 15:46:52 -0800 >>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wibbled: >>>> size_t s = sizeof 'a'; >>>> >>>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? >>> >>> Interesting, I didn't know C would return 4 (just tested it, it does). I >>> could understand it if it was in double quotes and so was a pointer but >>> what is the logic behind returning 4 for an explicit single byte character? >>> >> >> Character constants, like 'a', were found in the earliest days of C when >> everything that was a number was "int". So character constants, like >> all other C constants, were "int". This has remained unchanged - >> backwards compatibility is of huge importance in C. >> >> When C++ was young, the aim was to keep close compatibility with C when >> it did not interfere with other goals of the language. Having 'a' be of >> type "char", rather than "int", was important to C++ which now had >> overloading. > > Interesting. Fairly academic I suppose because I can't imagine any scenario > in a C program where you'd so sizeof on a char literal instead of just hard > coding a 1 though it could be a one way for the code to know if it had been > compiled by a C or C++ compiler. > I mostly code embedded systems and for systems that don't have direct display support (like LCD status displays or similar) we have to use int's and send them to the LCD display which can translate those into letters. Most displays are standardized about the same A = 4 that most architectures use. So it's used a lot in embedded systems like these. (although I've had a few cases where a shift register is used and A = 3 so those are always fun to debug) The "neos" project would have to account for this if it implements C and C++ because they are pretty solidified in both languages. So it'll be interesting to see how it's dealt with. -- Phillip ---------- - Adam: Is a void really a void if it returns? - Jack: No, it's just nullspace at that point. ----------
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2025-02-12 10:55 +0100 |
| Message-ID | <vohr77$295hl$1@dont-email.me> |
| In reply to | #121586 |
On 12/02/2025 00:46, Keith Thompson wrote: > Mr Flibble <leigh@i42.co.uk> writes: >> I hope to achieve neos Turing Completeness in March during a two week >> holiday. >> >> Also, did you know that with neos you can mix code from different >> programming languages in the same source code file! > > That's a remarkable assertion. > > I presume you're asserting that you can do this *and* the code will > execute correctly. > > Are you saying that that's possible in your current implementation, or > that it's something you intend to implement in the future? > > Does switching from one language to another require some kind of > explicit marker, or does neos figure it out? With what granularity? > > If the latter, how does it know whether > > size_t s = sizeof 'a'; > > is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? > I would assume that there must be some way to switch languages within the file, and tell the compiler what you are doing. Otherwise a switch between C and C++ is a pretty minor affair compared to a switch between, say, Cobol and Haskell. Maybe the OP could give us some more detail.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2025-02-12 02:47 -0800 |
| Message-ID | <8734gjo2ws.fsf@nosuchdomain.example.com> |
| In reply to | #121589 |
David Brown <david.brown@hesbynett.no> writes:
> On 12/02/2025 00:46, Keith Thompson wrote:
>> Mr Flibble <leigh@i42.co.uk> writes:
>>> I hope to achieve neos Turing Completeness in March during a two week
>>> holiday.
>>>
>>> Also, did you know that with neos you can mix code from different
>>> programming languages in the same source code file!
>> That's a remarkable assertion.
>> I presume you're asserting that you can do this *and* the code will
>> execute correctly.
>> Are you saying that that's possible in your current implementation,
>> or
>> that it's something you intend to implement in the future?
>> Does switching from one language to another require some kind of
>> explicit marker, or does neos figure it out? With what granularity?
>> If the latter, how does it know whether
>> size_t s = sizeof 'a';
>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to
>> 1)?
>
> I would assume that there must be some way to switch languages within
> the file, and tell the compiler what you are doing. Otherwise a
> switch between C and C++ is a pretty minor affair compared to a switch
> between, say, Cobol and Haskell. Maybe the OP could give us some more
> detail.
I would assume nothing (including that what "Mr Flibble" is claiming is
possible), which is why I asked.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Phillip <nntp@fulltermprivacy.com> |
|---|---|
| Date | 2025-02-12 11:36 -0500 |
| Message-ID | <voiimi$2cefi$2@dont-email.me> |
| In reply to | #121589 |
On 2/12/25 4:55 AM, David Brown wrote: > On 12/02/2025 00:46, Keith Thompson wrote: >> Mr Flibble <leigh@i42.co.uk> writes: >>> I hope to achieve neos Turing Completeness in March during a two week >>> holiday. >>> >>> Also, did you know that with neos you can mix code from different >>> programming languages in the same source code file! >> >> That's a remarkable assertion. >> >> I presume you're asserting that you can do this *and* the code will >> execute correctly. >> >> Are you saying that that's possible in your current implementation, or >> that it's something you intend to implement in the future? >> >> Does switching from one language to another require some kind of >> explicit marker, or does neos figure it out? With what granularity? >> >> If the latter, how does it know whether >> >> size_t s = sizeof 'a'; >> >> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? >> > > I would assume that there must be some way to switch languages within > the file, and tell the compiler what you are doing. Otherwise a switch > between C and C++ is a pretty minor affair compared to a switch between, > say, Cobol and Haskell. Maybe the OP could give us some more detail. > Maybe it uses the source file extension to determine which language to code against? I know that "technically" .c vs .cpp don't actually mean anything to a compiler but it's possible that "neos" would use that to determine it? Just a guess. -- Phillip ---------- - Adam: Is a void really a void if it returns? - Jack: No, it's just nullspace at that point. ----------
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2025-02-12 16:51 +0000 |
| Message-ID | <jk4rP.38219$0C51.15480@fx38.iad> |
| In reply to | #121593 |
Phillip <nntp@fulltermprivacy.com> writes: >On 2/12/25 4:55 AM, David Brown wrote: >> On 12/02/2025 00:46, Keith Thompson wrote: >>> Mr Flibble <leigh@i42.co.uk> writes: >>>> I hope to achieve neos Turing Completeness in March during a two week >>>> holiday. >>>> >>>> Also, did you know that with neos you can mix code from different >>>> programming languages in the same source code file! >>> >>> That's a remarkable assertion. >>> >>> I presume you're asserting that you can do this *and* the code will >>> execute correctly. >>> >>> Are you saying that that's possible in your current implementation, or >>> that it's something you intend to implement in the future? >>> >>> Does switching from one language to another require some kind of >>> explicit marker, or does neos figure it out? With what granularity? >>> >>> If the latter, how does it know whether >>> >>> size_t s = sizeof 'a'; >>> >>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? >>> >> >> I would assume that there must be some way to switch languages within >> the file, and tell the compiler what you are doing. Otherwise a switch >> between C and C++ is a pretty minor affair compared to a switch between, >> say, Cobol and Haskell. Maybe the OP could give us some more detail. >> > >Maybe it uses the source file extension to determine which language to >code against? I know that "technically" .c vs .cpp don't actually mean >anything to a compiler but it's possible that "neos" would use that to >determine it? Just a guess. A cobol compiler I once used had the ENTER SYMBOLIC verb to allow embedded assembler in the COBOL source file; a similar construct could be extended to support mixing any language. The difficulties in matching semantics and data layout between the different supported grammars would seem nigh insurmountable.
[toc] | [prev] | [next] | [standalone]
| From | Mr Flibble <leigh@i42.co.uk> |
|---|---|
| Date | 2025-02-12 21:58 +0000 |
| Message-ID | <ma6qqj5bs7nkv78ujlkjpgsj7uridrscs9@4ax.com> |
| In reply to | #121594 |
On Wed, 12 Feb 2025 16:51:27 GMT, scott@slp53.sl.home (Scott Lurndal) wrote: >Phillip <nntp@fulltermprivacy.com> writes: >>On 2/12/25 4:55 AM, David Brown wrote: >>> On 12/02/2025 00:46, Keith Thompson wrote: >>>> Mr Flibble <leigh@i42.co.uk> writes: >>>>> I hope to achieve neos Turing Completeness in March during a two week >>>>> holiday. >>>>> >>>>> Also, did you know that with neos you can mix code from different >>>>> programming languages in the same source code file! >>>> >>>> That's a remarkable assertion. >>>> >>>> I presume you're asserting that you can do this *and* the code will >>>> execute correctly. >>>> >>>> Are you saying that that's possible in your current implementation, or >>>> that it's something you intend to implement in the future? >>>> >>>> Does switching from one language to another require some kind of >>>> explicit marker, or does neos figure it out? With what granularity? >>>> >>>> If the latter, how does it know whether >>>> >>>>     size_t s = sizeof 'a'; >>>> >>>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? >>>> >>> >>> I would assume that there must be some way to switch languages within >>> the file, and tell the compiler what you are doing. Otherwise a switch >>> between C and C++ is a pretty minor affair compared to a switch between, >>> say, Cobol and Haskell. Maybe the OP could give us some more detail. >>> >> >>Maybe it uses the source file extension to determine which language to >>code against? I know that "technically" .c vs .cpp don't actually mean >>anything to a compiler but it's possible that "neos" would use that to >>determine it? Just a guess. > >A cobol compiler I once used had the ENTER SYMBOLIC verb to allow >embedded assembler in the COBOL source file; a similar construct >could be extended to support mixing any language. > >The difficulties in matching semantics and data layout between >the different supported grammars would seem nigh insurmountable. In the unlikely event that two semantic concepts don't fold a compiler error is raised. /Flibble
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2025-02-12 15:00 -0800 |
| Message-ID | <87y0yan4zz.fsf@nosuchdomain.example.com> |
| In reply to | #121596 |
Mr Flibble <leigh@i42.co.uk> writes:
> On Wed, 12 Feb 2025 16:51:27 GMT, scott@slp53.sl.home (Scott Lurndal)
> wrote:
[...]
>>>> On 12/02/2025 00:46, Keith Thompson wrote:
>>>>> Mr Flibble <leigh@i42.co.uk> writes:
>>>>>> I hope to achieve neos Turing Completeness in March during a two week
>>>>>> holiday.
>>>>>>
>>>>>> Also, did you know that with neos you can mix code from different
>>>>>> programming languages in the same source code file!
>>>>>
>>>>> That's a remarkable assertion.
>>>>>
>>>>> I presume you're asserting that you can do this *and* the code will
>>>>> execute correctly.
>>>>>
>>>>> Are you saying that that's possible in your current implementation, or
>>>>> that it's something you intend to implement in the future?
You didn't answer this. I presume you haven't implemented this. If
that's correct, please stop referring to neos's capabilities in the
present tense.
>>>>> Does switching from one language to another require some kind of
>>>>> explicit marker, or does neos figure it out? With what granularity?
>>>>>
>>>>> If the latter, how does it know whether
>>>>>
>>>>> size_t s = sizeof 'a';
>>>>>
>>>>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)?
You didn't answer my question about granularity. Will I be able to
write one line of code in C, another in C++ and another in Cobol, all
within the same function/procedure/subprogram? Or is it finer than
that? If I write
DISPLAY printf("hello\n")
will it print "hello" to stdout and then use the Cobol DISPLAY verb to
display the result returned by printf (which is a C int, not of any
Cobol type)?
[...]
> In the unlikely event that two semantic concepts don't fold a compiler
> error is raised.
In the "unlikely event"? I think you vastly underestimate the
complexity of the task.
So you're saying that there's no explicit marker indicating what
language is being used. The system just figures it out.
I don't believe that's possible in general.
For a lot of C code, perhaps most of it, it's impossible to tell whether
it's C or C++ -- and Objective-C is supposed to be a strict superset of
C. If I write `printf("hello, world\n");`, do you process it as C, or
as C++, or as Objective-C? If a 10000-line source file is almost
entirely valid C with a single line that's C++, what will
void func(void) {
int i = 10;
int I = 20;
writeln(i);
}
What does this print? (Pascal identifiers are case-insensitive.)
Or is this one of the "unlikely" cases where you'd raise an error?
And why would programmers *want* to do this? If I wanted to mix
languages in a single source file (I don't), I'd insist on an
unambiguous indication of what language each piece of code is
written in. Without that, maintenance would be a nightmare.
Language grammars, except in rare cases, are not designed to be
mixed with other language grammars. I don't believe what you're
proposing is either possible or desirable, and I certainly don't believe
you've done it.
A "universal compiler" could be useful (if it were possible).
I'd like to encourage everyone else *not* to speculate about what
Mr Flibble has in mind.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2025-02-12 12:26 -0500 |
| Message-ID | <voilk5$2dbav$1@dont-email.me> |
| In reply to | #121593 |
On 2/12/25 11:36, Phillip wrote: > On 2/12/25 4:55 AM, David Brown wrote: >> On 12/02/2025 00:46, Keith Thompson wrote: >>> Mr Flibble <leigh@i42.co.uk> writes: ... >>>> Also, did you know that with neos you can mix code from different >>>> programming languages in the same source code file! ... >>> Does switching from one language to another require some kind of >>> explicit marker, or does neos figure it out? With what granularity? ... >> I would assume that there must be some way to switch languages within >> the file, and tell the compiler what you are doing. Otherwise a switch ... > Maybe it uses the source file extension to determine which language to > code against? I know that "technically" .c vs .cpp don't actually mean > anything to a compiler but it's possible that "neos" would use that to > determine it? Just a guess. How would the file extension help with changes in the programming language that occur within a single source code file?
[toc] | [prev] | [next] | [standalone]
| From | Phillip <nntp@fulltermprivacy.com> |
|---|---|
| Date | 2025-02-13 00:00 -0500 |
| Message-ID | <vojua0$2ovad$1@dont-email.me> |
| In reply to | #121595 |
On 2/12/25 12:26 PM, James Kuyper wrote: > On 2/12/25 11:36, Phillip wrote: >> On 2/12/25 4:55 AM, David Brown wrote: >>> On 12/02/2025 00:46, Keith Thompson wrote: >>>> Mr Flibble <leigh@i42.co.uk> writes: > ... >>>>> Also, did you know that with neos you can mix code from different >>>>> programming languages in the same source code file! > ... >>>> Does switching from one language to another require some kind of >>>> explicit marker, or does neos figure it out? With what granularity? > ... >>> I would assume that there must be some way to switch languages within >>> the file, and tell the compiler what you are doing. Otherwise a switch > ... >> Maybe it uses the source file extension to determine which language to >> code against? I know that "technically" .c vs .cpp don't actually mean >> anything to a compiler but it's possible that "neos" would use that to >> determine it? Just a guess. > > How would the file extension help with changes in the programming > language that occur within a single source code file? > Maybe I missed something. Is dev claiming you can write code from different languages in the same file? -- Phillip ---------- - Adam: Is a void really a void if it returns? - Jack: No, it's just nullspace at that point. ----------
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2025-02-13 06:46 -0500 |
| Message-ID | <vokm1u$2sobg$1@dont-email.me> |
| In reply to | #121601 |
On 2/13/25 00:00, Phillip wrote: > On 2/12/25 12:26 PM, James Kuyper wrote: >> On 2/12/25 11:36, Phillip wrote: >>> On 2/12/25 4:55 AM, David Brown wrote: >>>> On 12/02/2025 00:46, Keith Thompson wrote: >>>>> Mr Flibble <leigh@i42.co.uk> writes: >> ... >>>>>> Also, did you know that with neos you can mix code from different >>>>>> programming languages in the same source code file! ... >> How would the file extension help with changes in the programming >> language that occur within a single source code file? >> > > Maybe I missed something. Is dev claiming you can write code from > different languages in the same file? See above, where he says "same source code file". In my previous message I trimmed everything from the previous conversation except the parts most directly relevant to that claim. This time I trimmed everything except the claim itself.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2025-02-12 13:58 -0800 |
| Message-ID | <voj5i5$2h10a$1@dont-email.me> |
| In reply to | #121589 |
On 2/12/2025 1:55 AM, David Brown wrote:
> On 12/02/2025 00:46, Keith Thompson wrote:
>> Mr Flibble <leigh@i42.co.uk> writes:
>>> I hope to achieve neos Turing Completeness in March during a two week
>>> holiday.
>>>
>>> Also, did you know that with neos you can mix code from different
>>> programming languages in the same source code file!
>>
>> That's a remarkable assertion.
>>
>> I presume you're asserting that you can do this *and* the code will
>> execute correctly.
>>
>> Are you saying that that's possible in your current implementation, or
>> that it's something you intend to implement in the future?
>>
>> Does switching from one language to another require some kind of
>> explicit marker, or does neos figure it out? With what granularity?
>>
>> If the latter, how does it know whether
>>
>> size_t s = sizeof 'a';
>>
>> is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)?
>>
>
> I would assume that there must be some way to switch languages within
> the file, and tell the compiler what you are doing. Otherwise a switch
> between C and C++ is a pretty minor affair compared to a switch between,
> say, Cobol and Haskell. Maybe the OP could give us some more detail.
>
Something like special tags?
<AppleSoft BASIC>
<code here>
</AppleSoft BASIC>
<C++23>
<code here>
</C++23>
<Python 3>
<code here>
</Python 3>
<C11>
<code here>
</C11>
<Python 2>
<code here>
</Python 2>
Just guessing here...
[toc] | [prev] | [next] | [standalone]
| From | Mr Flibble <leigh@i42.co.uk> |
|---|---|
| Date | 2025-02-12 22:00 +0000 |
| Message-ID | <ne6qqjtnq6r3kcrb7c4k3jjccoce4759bu@4ax.com> |
| In reply to | #121586 |
On Tue, 11 Feb 2025 15:46:52 -0800, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >Mr Flibble <leigh@i42.co.uk> writes: >> I hope to achieve neos Turing Completeness in March during a two week >> holiday. >> >> Also, did you know that with neos you can mix code from different >> programming languages in the same source code file! > >That's a remarkable assertion. > >I presume you're asserting that you can do this *and* the code will >execute correctly. Of course. > >Are you saying that that's possible in your current implementation, or >that it's something you intend to implement in the future? It will be possible in 1.0. > >Does switching from one language to another require some kind of >explicit marker, or does neos figure it out? With what granularity? In 1.0 a marker will be used. > >If the latter, how does it know whether > > size_t s = sizeof 'a'; > >is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)? /Flibble
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2025-02-12 15:05 -0800 |
| Message-ID | <87tt8yn4qy.fsf@nosuchdomain.example.com> |
| In reply to | #121598 |
Mr Flibble <leigh@i42.co.uk> writes:
> On Tue, 11 Feb 2025 15:46:52 -0800, Keith Thompson
> <Keith.S.Thompson+u@gmail.com> wrote:
>>Mr Flibble <leigh@i42.co.uk> writes:
>>> I hope to achieve neos Turing Completeness in March during a two week
>>> holiday.
>>>
>>> Also, did you know that with neos you can mix code from different
>>> programming languages in the same source code file!
>>
>>That's a remarkable assertion.
>>
>>I presume you're asserting that you can do this *and* the code will
>>execute correctly.
>
> Of course.
>
>>
>>Are you saying that that's possible in your current implementation, or
>>that it's something you intend to implement in the future?
>
> It will be possible in 1.0.
>
>>
>>Does switching from one language to another require some kind of
>>explicit marker, or does neos figure it out? With what granularity?
>
> In 1.0 a marker will be used.
>
>>
>>If the latter, how does it know whether
>>
>> size_t s = sizeof 'a';
>>
>>is C (typically setting s to 4, sizeof (int)) or C++ (setting s to 1)?
I just replied to your followup elsewhere in this thread, where you
indicated that no markers would be needed.
Are you saying that the marker will be unnecessary in later versions?
(If not, why not just say "A marker will be used" without reference to a
release number.)
My questions stand for later releases.
Again, I suggest that speculation from others is not helpful.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2025-02-13 17:34 -0500 |
| Message-ID | <vols20$33pld$1@dont-email.me> |
| In reply to | #121598 |
On 2/12/25 17:00, Mr Flibble wrote: > On Tue, 11 Feb 2025 15:46:52 -0800, Keith Thompson > <Keith.S.Thompson+u@gmail.com> wrote: > >> Mr Flibble <leigh@i42.co.uk> writes: >>> I hope to achieve neos Turing Completeness in March during a two week >>> holiday. >>> >>> Also, did you know that with neos you can mix code from different >>> programming languages in the same source code file! ... >> Does switching from one language to another require some kind of >> explicit marker, or does neos figure it out? With what granularity? > > In 1.0 a marker will be used. How would that work? If you use a fixed marker, it would have to be something that wasn't a valid piece of program text in any of the supported languages. But if yours is to be a universal compiler, that becomes an impossible decision - every possible marker is valid program text in as least one of the supported languages. The obvious solution is to use different markers for different languages - but that would still run afoul of any language that didn't have any invalid program texts. How universal do you really want your compiler to be? Take a look at <https://en.wikipedia.org/wiki/Esoteric_programming_language>. How many of them could neos handle? Most of the languages described there are just elaborate jokes of one kind or another - but as such they provide useful test cases for anything intended to be a truly universal compiler. Any feature of one of those esoteric programming languages that would make it hard to handle is something that might come up in a non-joke language.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2025-02-14 09:48 +0100 |
| Message-ID | <von01o$3cr6m$1@dont-email.me> |
| In reply to | #121603 |
On 13/02/2025 23:34, James Kuyper wrote: > On 2/12/25 17:00, Mr Flibble wrote: >> On Tue, 11 Feb 2025 15:46:52 -0800, Keith Thompson >> <Keith.S.Thompson+u@gmail.com> wrote: >> >>> Mr Flibble <leigh@i42.co.uk> writes: >>>> I hope to achieve neos Turing Completeness in March during a two week >>>> holiday. >>>> >>>> Also, did you know that with neos you can mix code from different >>>> programming languages in the same source code file! > ... >>> Does switching from one language to another require some kind of >>> explicit marker, or does neos figure it out? With what granularity? >> >> In 1.0 a marker will be used. > > How would that work? If you use a fixed marker, it would have to be > something that wasn't a valid piece of program text in any of the > supported languages. But if yours is to be a universal compiler, that > becomes an impossible decision - every possible marker is valid program > text in as least one of the supported languages. > The obvious solution is to use different markers for different languages > - but that would still run afoul of any language that didn't have any > invalid program texts. > > How universal do you really want your compiler to be? Take a look at > <https://en.wikipedia.org/wiki/Esoteric_programming_language>. How many > of them could neos handle? Most of the languages described there are > just elaborate jokes of one kind or another - but as such they provide > useful test cases for anything intended to be a truly universal > compiler. Any feature of one of those esoteric programming languages > that would make it hard to handle is something that might come up in a > non-joke language. > If it were me that was designing this concept, I'd pick some syntax that would be very unlikely to come up in real code - even if it might be valid syntax in one or more languages. For example, decide that the sequence "#¤§" at the start of a line is a "neos meta-escape". How likely is it that those characters might form part of a normal valid line in some programming language? It's rather unlikely. The same goes for something longer but less cryptic, such as "##NEOS##". It does mean that people who use Neos and mix different languages in the same file might have an restriction on the code they can use - but it is merely a hypothetical restriction. You could also have a requirement that mixed-language files need to be compiled in "neos" mode (rather than C mode, or Pascal mode, or whatever). They then start off in "neos meta-escape" mode, and as well as allowing the choice of language (and perhaps standard version, flags, etc.) this could also have a command to change the "neos meta-escape" sequence. So for those that wanted to use "#¤§" as a new operator in Forth, their first line of the file could be : #¤§ NEOS-META-ESCAPE = ☺⫸ (I hope those Unicode symbols came through okay.) I'm not suggesting that I think any of this mixture is a good idea, but I don't think making language-change markers is the biggest issue.
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.c++
csiph-web