Perl / Perl/PPCs

[PPC0019] - Should it be a sublex?

Open
#47 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
79
Forks
28
PR merge metrics
No merged PRs in 30d

Description

First interesting question: Should qt() strings be sub-lexed, or not..?

I.e. what do people feel -should- be the behaviour of a construction like

sub f { ... }

say qt(Is this { f(")") } valid syntax?);

Should it:

  1. Yield a parse error similar to the ones given in the example above?
  2. Parse as valid perl code yielding a similar result to:
     say 'Is this ', f(")"), ' valid syntax?';
  1. Something else?

I feel that interpretation 2 might be most useful and powerful, but would be inconsistent with existing behaviour of existing operators. Interpretation 1 is certainly easier to achieve as it reüses existing parser structures, but given the whole point is to interpolate code inside the {braces} it might lead to weird annoying cases that don't work so well.

Does anyone have any good examples one way or other from other languages that have a similar construction?

(Cross-posted to https://www.nntp.perl.org/group/perl.perl5.porters/2024/01/msg267671.html)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed qt() examples and the alternatives described in this issue, then review the cross-posted Perl porters discussion. No files or tests are named; the work would need to establish a decision about sub-lexing and define what behavior is considered complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.