#pragma


(isidoro carlo ghezzi) #1

I have this code:

let tuple = (
MARK: 1,
EXPLODE: true,
DO_SOMETHINGS_UNDEFINED: true
)

If I comment it, because I want to exclude that code to be compiled:

// let tuple = (
// MARK: 1,
// EXPLODE: true,
// DO_SOMETHINGS_UNDEFINED: true
// )

what will happen to the IDE?
Commenting that code, I didn't mean to give strange instructions to the IDE.

Isidoro.

···

On Sep 05, 2016, at 07:16 AM, Marinus van der Lugt <rien@starbase55.com> wrote:

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.


(Rien) #2

Ah :slight_smile:
Yes that could lead to unexpected behaviour of the IDE.
However I would not qualify that as dangerous. The code is indeed excluded as was the intention.
Re-introducing the #pragma for that purpose seems a bit OTT to me.

Rien.

···

On 05 Sep 2016, at 10:37, isidoro carlo ghezzi <isidoro.ghezzi@icloud.com> wrote:

I have this code:

let tuple = (
MARK: 1,
EXPLODE: true,
DO_SOMETHINGS_UNDEFINED: true
)

If I comment it, because I want to exclude that code to be compiled:

// let tuple = (
// MARK: 1,
// EXPLODE: true,
// DO_SOMETHINGS_UNDEFINED: true
// )

what will happen to the IDE?
Commenting that code, I didn't mean to give strange instructions to the IDE.

Isidoro.

On Sep 05, 2016, at 07:16 AM, Marinus van der Lugt <rien@starbase55.com> wrote:

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.


(Anton Zhilin) #3

AFAIK, if one would extend Swift beyond its "official" specification,
it could be done using #-directives and @-attributes, like Swift
playgrounds use #imageLiteral(...) and friends. It's somewhat equivalent to
pragmas of C++. On the other hand, things that are not understood by target
compiler, but are features of an IDE, are done using comments. Fair enough?