Zulip Chat Archive

Stream: Is there code for X?

Topic: Definitions that are only valid in certain sections.


Asei Inoue (Feb 24 2024 at 09:50):

section

-- definition in a section.
-- Could the code be rewritten so that the name is only valid within a section?
abbrev longLongName := Nat

end

-- test code. this code should success
#check_failure longLongName

Yaël Dillies (Feb 24 2024 at 10:08):

Have you thought of using namespaces?

Yaël Dillies (Feb 24 2024 at 10:08):

Or private?

Asei Inoue (Feb 24 2024 at 10:10):

This also fails....

namespace Sample

-- definition in a section.
-- Could the code be rewritten so that the name is only valid within a section?
private abbrev anotherNat := Nat

#check Sample.anotherNat

end Sample

-- test code. this code should success
#check_failure Sample.anotherNat

Yaël Dillies (Feb 24 2024 at 11:51):

It doesn't fail once you go to a different file

Asei Inoue (Feb 25 2024 at 13:30):

Is it possible to disable the section or namespace instead of the file?


Last updated: May 02 2025 at 03:31 UTC