#pragma

Hi all,

I think the "old style" `#pragma` is necessary in Swift.
Exactly in the same way it is available in C/C++ or Objective-C/C++, or in something else portable way.

Because `#pragma` is not handled in Swift, in Xcode they overloaded the semantic of comments, giving to the comment `// MARK:` the semantic of `#pragma mark`

But my point of view is that, I would like that what it is written in a source comment (what it is written after a // or between /* */ ) should be fully ignore by compiler or IDE.

I understand that maybe a compiler shouldn't lose time handling `#pragma options`, but giving semantics to source comment, I think it can be dangerous and misunderstood.

The implementation in Swift compiler should be simple, ignoring any line beginning with `#pragma` (ok I know It is not simple)
The IDE will handle the `#pragma`

That's why they invented `#pragma`in C/C++ Objective-C/C++ right?

Thanks for your attention, and sorry for my bad english: I am Italian native spoke language.

#pragma mark - sign
Best Regards,
Isidoro Ghezzi

There is a *lot* more to `#pragma` than `#pragma mark`, but it's unclear to me what other pragma anyone would bring over from C. Given that, I'm not in favor of a new language construct for just one thing that's not horribly out of place as a comment.

Félix

···

Le 4 sept. 2016 à 15:53:46, isidoro carlo ghezzi via swift-evolution <swift-evolution@swift.org> a écrit :

Hi all,

I think the "old style" `#pragma` is necessary in Swift.
Exactly in the same way it is available in C/C++ or Objective-C/C++, or in something else portable way.

Because `#pragma` is not handled in Swift, in Xcode they overloaded the semantic of comments, giving to the comment `// MARK:` the semantic of `#pragma mark`

But my point of view is that, I would like that what it is written in a source comment (what it is written after a // or between /* */ ) should be fully ignore by compiler or IDE.

I understand that maybe a compiler shouldn't lose time handling `#pragma options`, but giving semantics to source comment, I think it can be dangerous and misunderstood.

The implementation in Swift compiler should be simple, ignoring any line beginning with `#pragma` (ok I know It is not simple)
The IDE will handle the `#pragma`

That's why they invented `#pragma`in C/C++ Objective-C/C++ right?

Thanks for your attention, and sorry for my bad english: I am Italian native spoke language.

#pragma mark - sign
Best Regards,
Isidoro Ghezzi

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

The context of comments should clearly not be ignored by IDEs. If you did that, the entire feature set of doc comments would go away.

-David

···

Sent from my iPhone

On Sep 4, 2016, at 5:15 PM, Félix Cloutier via swift-evolution <swift-evolution@swift.org> wrote:

There is a *lot* more to `#pragma` than `#pragma mark`, but it's unclear to me what other pragma anyone would bring over from C. Given that, I'm not in favor of a new language construct for just one thing that's not horribly out of place as a comment.

Félix

Le 4 sept. 2016 à 15:53:46, isidoro carlo ghezzi via swift-evolution <swift-evolution@swift.org> a écrit :

Hi all,

I think the "old style" `#pragma` is necessary in Swift.
Exactly in the same way it is available in C/C++ or Objective-C/C++, or in something else portable way.

Because `#pragma` is not handled in Swift, in Xcode they overloaded the semantic of comments, giving to the comment `// MARK:` the semantic of `#pragma mark`

But my point of view is that, I would like that what it is written in a source comment (what it is written after a // or between /* */ ) should be fully ignore by compiler or IDE.

I understand that maybe a compiler shouldn't lose time handling `#pragma options`, but giving semantics to source comment, I think it can be dangerous and misunderstood.

The implementation in Swift compiler should be simple, ignoring any line beginning with `#pragma` (ok I know It is not simple)
The IDE will handle the `#pragma`

That's why they invented `#pragma`in C/C++ Objective-C/C++ right?

Thanks for your attention, and sorry for my bad english: I am Italian native spoke language.

#pragma mark - sign
Best Regards,
Isidoro Ghezzi

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I understand that maybe a compiler shouldn't lose time handling `#pragma options`, but giving semantics to source comment, I think it can be dangerous and misunderstood.

Could you elaborate what could be dangerous or misunderstood?

Rien.

I don’t think it is a reason pragma exists. except for #pragma mark, I’m not sure the compiler ignore any pragma. They are used to control the compiler behaviors (controlling warning, specifying linker dependencies, enabled specific feature like OpenMP, etc…) and not at all to interact with the IDE. I would even says that pragma mark is an abuse of the #pragma construct as it is ignored by the compiler and used by the IDE only.

I’m strongly again introducing #pragma without very very good reason into swift. Asking the IDE to parse comment to extract metadata is not worst abusing pragma to do the same, and at least it is forward and backward compatible with any other tools.

···

Le 5 sept. 2016 à 00:53, isidoro carlo ghezzi via swift-evolution <swift-evolution@swift.org> a écrit :

Hi all,

I think the "old style" `#pragma` is necessary in Swift.
Exactly in the same way it is available in C/C++ or Objective-C/C++, or in something else portable way.

Because `#pragma` is not handled in Swift, in Xcode they overloaded the semantic of comments, giving to the comment `// MARK:` the semantic of `#pragma mark`

But my point of view is that, I would like that what it is written in a source comment (what it is written after a // or between /* */ ) should be fully ignore by compiler or IDE.

I understand that maybe a compiler shouldn't lose time handling `#pragma options`, but giving semantics to source comment, I think it can be dangerous and misunderstood.

The implementation in Swift compiler should be simple, ignoring any line beginning with `#pragma` (ok I know It is not simple)
The IDE will handle the `#pragma`

That's why they invented `#pragma`in C/C++ Objective-C/C++ right?

I agree: "mark" (IMO) is in the same category as "todo" and "fixme", and
all are bona fide comments. If you wish your code to be disabled without
becoming parsed as a comment, use instead `#if false`.

···

On Mon, Sep 5, 2016 at 15:27 Jean-Daniel Dupas via swift-evolution < swift-evolution@swift.org> wrote:

> Le 5 sept. 2016 à 00:53, isidoro carlo ghezzi via swift-evolution < > swift-evolution@swift.org> a écrit :
>
> Hi all,
>
> I think the "old style" `#pragma` is necessary in Swift.
> Exactly in the same way it is available in C/C++ or Objective-C/C++, or
in something else portable way.
>
> Because `#pragma` is not handled in Swift, in Xcode they overloaded the
semantic of comments, giving to the comment `// MARK:` the semantic of
`#pragma mark`
>
> But my point of view is that, I would like that what it is written in a
source comment (what it is written after a // or between /* */ ) should be
fully ignore by compiler or IDE.
>
> I understand that maybe a compiler shouldn't lose time handling `#pragma
options`, but giving semantics to source comment, I think it can be
dangerous and misunderstood.
>
> The implementation in Swift compiler should be simple, ignoring any line
beginning with `#pragma` (ok I know It is not simple)
> The IDE will handle the `#pragma`
>
> That's why they invented `#pragma`in C/C++ Objective-C/C++ right?

I don’t think it is a reason pragma exists. except for #pragma mark, I’m
not sure the compiler ignore any pragma. They are used to control the
compiler behaviors (controlling warning, specifying linker dependencies,
enabled specific feature like OpenMP, etc…) and not at all to interact with
the IDE. I would even says that pragma mark is an abuse of the #pragma
construct as it is ignored by the compiler and used by the IDE only.

I’m strongly again introducing #pragma without very very good reason into
swift. Asking the IDE to parse comment to extract metadata is not worst
abusing pragma to do the same, and at least it is forward and backward
compatible with any other tools.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

// isghe: ok

···

Sent from my iPhone

On 05 Sep 2016, at 22:31, Xiaodi Wu <xiaodi.wu@gmail.com> wrote:

I agree: "mark" (IMO) is in the same category as "todo" and "fixme", and all are bona fide comments. If you wish your code to be disabled without becoming parsed as a comment, use instead `#if false`.

On Mon, Sep 5, 2016 at 15:27 Jean-Daniel Dupas via swift-evolution <swift-evolution@swift.org> wrote:

> Le 5 sept. 2016 à 00:53, isidoro carlo ghezzi via swift-evolution <swift-evolution@swift.org> a écrit :
>
> Hi all,
>
> I think the "old style" `#pragma` is necessary in Swift.
> Exactly in the same way it is available in C/C++ or Objective-C/C++, or in something else portable way.
>
> Because `#pragma` is not handled in Swift, in Xcode they overloaded the semantic of comments, giving to the comment `// MARK:` the semantic of `#pragma mark`
>
> But my point of view is that, I would like that what it is written in a source comment (what it is written after a // or between /* */ ) should be fully ignore by compiler or IDE.
>
> I understand that maybe a compiler shouldn't lose time handling `#pragma options`, but giving semantics to source comment, I think it can be dangerous and misunderstood.
>
> The implementation in Swift compiler should be simple, ignoring any line beginning with `#pragma` (ok I know It is not simple)
> The IDE will handle the `#pragma`
>
> That's why they invented `#pragma`in C/C++ Objective-C/C++ right?

I don’t think it is a reason pragma exists. except for #pragma mark, I’m not sure the compiler ignore any pragma. They are used to control the compiler behaviors (controlling warning, specifying linker dependencies, enabled specific feature like OpenMP, etc…) and not at all to interact with the IDE. I would even says that pragma mark is an abuse of the #pragma construct as it is ignored by the compiler and used by the IDE only.

I’m strongly again introducing #pragma without very very good reason into swift. Asking the IDE to parse comment to extract metadata is not worst abusing pragma to do the same, and at least it is forward and backward compatible with any other tools.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution