June 06, 2022
On Sunday, 5 June 2022 at 22:41:14 UTC, Walter Bright wrote:
> On 6/4/2022 10:54 PM, Paulo Pinto wrote:
>> That paper had a real implementation to follow along,
>
> I didn't see it.
>
>> while Lucid and IBM products were real things one could buy.
>
> That are *C* compilers doing imports for *C* code?
>
> What C compilers have imports:
>
> gcc - nope
> clang - nope
> VC - nope
> Digital Mars C - nope
> C Standard - nope
>
> ImportC - yes!

https://clang.llvm.org/docs/Modules.html

And I am out of this thread.


June 06, 2022
On Monday, 6 June 2022 at 05:48:14 UTC, Ali Çehreli wrote:
>
> Now, that is trolling.
>
> Ali

Well, I could argue, correctly, that trolling is when someone picks only part of your argument, and uses only that part to support their own agenda - which is to destroy your argument by making it out to be something it is not.

June 06, 2022
On Monday, 6 June 2022 at 05:48:14 UTC, Ali Çehreli wrote:
>
> Now, that is trolling.
>
> Ali

juvenalian satire, perhaps. I'd accept that.

But trolling? Really?
June 06, 2022

On Monday, 6 June 2022 at 05:01:27 UTC, forkit wrote:

>

The addidtion of a little character, @, to word private, could change this:

@private // Compiler says: oh. so you really want private to mean private? ok. I'll do it for you. no problem.

You need a DIP.

June 06, 2022
On Monday, 6 June 2022 at 03:17:34 UTC, forkit wrote:
> On Monday, 6 June 2022 at 00:19:16 UTC, zjh wrote:
>> On Sunday, 5 June 2022 at 22:41:41 UTC, Walter Bright wrote:
>>
>>
> But yes, as far as i know, D is the first to do this - i.e. turn the class into a pseudo type, that cannot have encapsulation unless it is put into a super type (the module), all by its self (with no friends).


Delphi / Object Pascal had the same visibility as D, private only meant private to the module.
June 06, 2022

On Monday, 6 June 2022 at 01:05:38 UTC, zjh wrote:

>

On Monday, 6 June 2022 at 00:19:16 UTC, zjh wrote:

> >

Because it's fun to be first!
Yes, 'd' is always independent.

C++'s moudle

D, hurry up and get nervous.

C++ has had modules for a while, but only Microsoft has a fully compliant implementation:

https://en.cppreference.com/w/cpp/language/modules
https://en.cppreference.com/w/cpp/compiler_support/20

Give it a year to be fully usable across compilers.

June 06, 2022

On Monday, 6 June 2022 at 05:49:55 UTC, Paulo Pinto wrote:

>

https://clang.llvm.org/docs/Modules.html

And I am out of this thread.

Yes, Objective-C has added modules to C since forever… Just rename your .c file to .m

I guess that would be the first.

June 06, 2022

On Monday, 6 June 2022 at 11:02:32 UTC, Ola Fosheim Grøstad wrote:

>

Yes, Objective-C has added modules to C since forever… Just rename your .c file to .m

I guess that would be the first.

Or maybe not… you still use .h, so it depends on the implementation. Pointless discussion really.

June 06, 2022
On Monday, 6 June 2022 at 05:49:55 UTC, Paulo Pinto wrote:
> On Sunday, 5 June 2022 at 22:41:14 UTC, Walter Bright wrote:
>> On 6/4/2022 10:54 PM, Paulo Pinto wrote:
>>> That paper had a real implementation to follow along,
>>
>> I didn't see it.
>>
>>> while Lucid and IBM products were real things one could buy.
>>
>> That are *C* compilers doing imports for *C* code?
>>
>> What C compilers have imports:
>>
>> gcc - nope
>> clang - nope
>> VC - nope
>> Digital Mars C - nope
>> C Standard - nope
>>
>> ImportC - yes!
>
> https://clang.llvm.org/docs/Modules.html
>
> And I am out of this thread.

https://clang.llvm.org/docs/Modules.html#objective-c-import-declaration

"At present, there is no C or C++ syntax for import declarations. Clang will track the modules proposal in the C++ committee. See the section Includes as imports to see how modules get imported today."

So Object-C can import C, but *C* cannot import *C*.

Walter added __import support in *.c, clang could have done the same but they *didn't*, they were also probably just 10 lines away from the goal.

June 06, 2022
On Monday, 6 June 2022 at 03:17:34 UTC, forkit wrote:
> cannot have encapsulation unless it is put into a super type
> (the module), all by its self (with no friends).

It can have friends - they just need to be in the same file (module).
And a class without its friend is really only half a type - that's why it is better to think of the module as the new type - which contains both the interface and all interna (friends and sub-classes and @system parts that should not be visible from the outside).

That's what a file is for in general: to collect things that belong together and should be seen as a single object. It makes no sense to put other unrelated classes or functions into the same file. Especially not in a large project (which is the only case where encapsulation makes sense at all).