Wiki

Ticket #35 (closed enhancement: fixed)

Opened 16 years ago

Last modified 16 years ago

compiler Directives for target(type) and reference

Reported by: hopscc Owned by: Chuck
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

heres a patch for supporting the current commandline -target and -reference specifications as compiler directives.
e.g
%% Target winexe
%% Reference System.Windows.Form
%% Reference "System.Drawing".
This allows build of things like libraries to be entirely(*) source code specified.

The patch includes a mod to the %% throw compiler directive to specify an optional string that will be printed before the exception is thrown.

(*) For completeness we should also allow -embed-run-time to be specified this way but if the default state of this is to be reversed eventually (loaded to GAC) its arguably not going to be needed.

There was some mention of 'use <namespace>' being eventually enhanced in some fashion to make the -reference switch somewhat less necessary... when/if that happens the compiler Directive
probably be deprecated if the same capability is available..

Attachments

compilerDirectiveTgtDll.patch Download (14.2 KB) - added by hopscc 16 years ago.
compDirArgOpts.patch Download (50.3 KB) - added by hopscc 16 years ago.
throwStop.patch Download (1.2 KB) - added by hopscc 16 years ago.
compDirOpts2.patch Download (45.8 KB) - added by hopscc 16 years ago.

Change History

Changed 16 years ago by hopscc

Changed 16 years ago by hopscc

  • status changed from new to assigned
  • owner set to Chuck

Changed 16 years ago by Chuck

  • owner changed from Chuck to hopscc

As you mentioned, the reference will eventually be implicit, although there is still the need to reference DLLs whose filenames don't match their namespaces.

But I'm also wondering if this could just be generalized to any command line arguments so that we don't have to write any specific code to mirror command line options. Instead, we'd have "%% args ..." and tap into the CommandLine class to parse what follows. If we get that working, then we're "done".

Presumably, multiple instances of "args" would be appended, in the order the files appeared on the command line.

Thoughts?

Changed 16 years ago by hopscc

Yeah - thats a better/cleaner general solution than just specifically supporting the ones that may be thought to be commonly needed/used
...
I'm wondering if its likely that theres cmdline args that you specifically dont want to support as directives - probably easy to suppress if need be

will rework...

Hmm could you open a discussion topic around where (if anywhere) you're thinking is with 'use <namespace>' to specify references (or anything else - filtering/renaming?)
I'm thinking something like
use <namespace> [ from <fileRef> ]
for this purpose buth theres possibly other interactions ....

Changed 16 years ago by hopscc

Changed 16 years ago by hopscc

Heres compDirArgOpts patch for compiler directive 'args' taking same options as command line and using same arg processor.
Somewhat more code bashing needed than anticipated.
Much reworking of cmdline arg processing and munging of library handling code.

No explicit suppression of any opts from compiler directive (just not handled)
and handing/modification/sync of verbose flag probably needs reexamining

Changed 16 years ago by hopscc

Changed 16 years ago by hopscc

compDirArgOpts.patch missed the minor tweak from the earlier patch for a
mod to the %% throw compiler directive to specify an optional string that will be printed before the exception is thrown.

throwStop.patch has that mod and a testfile for it.
This is standalone - can be applied with or without compDirArgOpts.patch...

Changed 16 years ago by hopscc

  • owner changed from hopscc to Chuck

Changed 16 years ago by Chuck

  • owner changed from Chuck to hopscc

When I apply the compDirArgsOpts.patch, I get some failures. Are you able to update the patch against the latest svn with a reasonably small effort?

Changed 16 years ago by Chuck

Btw I mean failures on patch application, not compiling the source or executing the code.

Changed 16 years ago by hopscc

Changed 16 years ago by hopscc

  • owner changed from hopscc to Chuck

This one time - new patch file against current src tree
Contents same as previous - does not include throwStop.patch contents

Changed 16 years ago by Chuck

  • status changed from assigned to closed
  • resolution set to fixed

Main patch applied. See changeset:1667

I'm rejecting the throwStop patch. It conflates generating compiler error messages (a legit, but separate idea) with making the compiler throw an *uncaught* exception for special testing purposes.

The first idea should be handled with an "error" directive, like what is done with gcc, and it should always call .throwError, not just when there is a message.

Note: See TracTickets for help on using tickets.