Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upDIP 1028 Make @safe the default #10709
Conversation
This comment has been minimized.
This comment has been minimized.
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#10709" |
This comment has been minimized.
This comment has been minimized.
|
Could do with some tests. |
This comment has been minimized.
This comment has been minimized.
I know. I'll add them tomorrow, which is why this is WIP. |
58466a2
to
9146326
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Added the test cases. |
This comment has been minimized.
This comment has been minimized.
|
I think there might be an issue in CTFE with this here: @safe:
import std.bitmanip;
struct X
{
@safe:
mixin(bitfields!(
uint, "hello", 4,
uint, "foo", 4
));
}in theory, because it's all marked as
|
This comment has been minimized.
This comment has been minimized.
|
delegates don't have the void foo(void delegate() x)
{
x();
}gives
advantages of this:
disadvantages of this:
|
This comment has been minimized.
This comment has been minimized.
|
@WebFreak001 fixed it. |
This comment has been minimized.
This comment has been minimized.
|
The commit name is quite confusing, it should mention the introduction of a switch, not "Make As discussed, a simple "Hello World" (using writeln) will not work without work on druntime/phobos:
Likewise, any call to Trying to compile druntime with this switch results in:
And since we're limited to 20 errors, I suspect this is just the tip of the iceberg. OS: Mac OSX 10.15 $ cd projects/dlang/dmd
$ git checkout walter/safeDefault
$ make -f posix.mak -j8 install
$ cd ../druntime
# At this point, one can choose to insert `-preview=safedefault` to compiler druntime
$ make -f posix.mak -j8 install
$ cd ../phobos/
# Likewise, `-preview=safedefault` in DFLAGS (didn't get that far because druntime didn't compile)
$ make -f posix.mak -j8 install
$ cd ../install
$ echo 'import std.stdio; void main() { writeln("Hello World"); }' > helloworld.d
$ ./osx/bin/dmd -preview=safedefault helloworld.dBy the way, the point where I inserted the |
This comment has been minimized.
This comment has been minimized.
|
@Geod24 I expect there'll be fixes needed in druntime/phobos. I don't mind doing that work, but I don't see much point until this PR is merged. |
This comment has been minimized.
This comment has been minimized.
|
The point was to be able to use, and by extension test, this switch (since at the moment absolutely nothing compiles when turned on, I can't even run an hello world). |
This comment has been minimized.
This comment has been minimized.
|
@Geod24 I think the point is things can't be fixed until this is merged. It needs a command-line switch to turn the functionality on anyway. |
This comment has been minimized.
This comment has been minimized.
|
@atilaneves : Nothing prevents druntime and Phobos to be fixed without merging this PR. Anyone working on DMD routinely needs to test a feature / deprecation / bug fix with at least druntime / phobos, and quite frequently other projects as well. But that's just my 0.02$, and if you two think it's better to proceed with this now, let's get it merged. However, could @WalterBright fix the commit message to "Introduce -preview=safeDefault" or something similar ? |
This comment has been minimized.
This comment has been minimized.
|
I didn't want to overcrowd the last message, but there's a few things I'd like to add regarding DIP1028. The "valuable feedback" I mentioned previously might include, but not be limited to:
And this is just from the top of my head. Most of my issues with DIP1028 is that you cannot live in a |
WalterBright commentedJan 2, 2020
•
edited
Implement the upcoming DIP.
https://github.com/dlang/DIPs/blob/1b705f8d4faa095d6d9e3a1b81d6cfa6d688554b/DIPs/DIP1028.md